Collecting all the values in a large structure into one variable?

I have a structure with:

years(1:10).months(1:12).Days(1:30).Values_T

years(1:10).months(1:12).Days(1:30).Values_S

How can I collect all the values from Values_T and put them into a single variable?

I wanted a variable called: Aggregate_Values_T that would have all the values from everyday in every month and year.

I tried running loops but everytime had no success...

Any help is appreciated..

After posting, I came up with this as a workaround:

pp = []; for yy = 1:4 for mm = 1:12 for dd = 1:length(Year(yy).Month(mm).Day) if isempty(Year(yy).Month(mm).Day(dd).Value)==1 continue else tt = Year(yy).Month(mm).Day(dd).Value; pp(end+1,1) = [tt] end end end end

It worked but its kind of messy... I would appreciate if anyone knew of a much cleaner and faster way...

-------------Problems Reply------------

You can catenate in the order years->months->Days->Values

aggregate_Months = cat(2,years(:).months);
aggregate_Days = cat(2,aggregate_Months(:).Days);
aggregate_Values_T = cat(2,aggregate_Days(:).Values_T);

Category:matlab Views:0 Time:2012-01-04

Related post

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.145 (s). 11 q(s)