How to iteratively go through a structure?
Show older comments
I have some data from 100 different tests that I ran. There are 2 variables that were swept through for 10 values each, resulting in 100 tests (i.e. variable 1 is A with 10 elements, variable 2 is B with 10 elements, my test data is from all the permutations of A and B). A few timeseries measurements are made for each test. I have my data saved in a structure like:
Data.A1.B1.meas1
Data.A1.B1.meas2
%...
Data.A1.B1.measN
Data.A1.B2.meas1
Data.A1.B2.meas2
%...
Data.A2.B1.meas1
%...
Data.A10.B10.measN
I need to take the mean of the timeseries data for each test. Is there some way to set up a loop such that I can easily iterate through the struct to do this? Some thing like:
for i = 1:10
for j = 1:10
DataMean = mean(Data.A(i).B(j).meas1)
end
end
Is there a more efficient way to structure the data to make this easier?
Accepted Answer
More Answers (0)
Categories
Find more on Structures in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!