categorizing tables after reading them.
11 views (last 30 days)
assuming we are reading some data files in matlab as tables, how can we create groups or categorizes that would classify the tables according to the ''HOUR'' value they are containing?
for ex: we want to have 6 bins or categorizes for all the data we have, as we divide the 24hr into 3hrs interval. so we would like to have the tables that their hour value is betweeen 0-3 in one group, and the tables their hour value between 4-7 in another group, tables with hours betweeen 8-11 in another group and so on.. for the all 24hrs.
assuming that each data file or (table) contains data for some interval of time how can we categorize each indiviual table and then all the tables?
thanks for looking at it,
Prachi Kulkarni on 18 Oct 2021
If you initially have all the data in a table T and HOUR is one the variables in table T, you can create separate tables depending upon the categorization of HOUR as follows.
T1 = T(T.HOUR>=0 & T.HOUR<=3,:);
T2 = T(T.HOUR>=4 & T.HOUR<=7,:);
T3 = T(T.HOUR>=8 & T.HOUR<=11,:);
T4 = T(T.HOUR>=12 & T.HOUR<=15,:);
T5 = T(T.HOUR>=16 & T.HOUR<=19,:);T6 = T(T.HOUR>=20 & T.HOUR<24,:);