I have the following 606 x 281 table ('ABC'):
- - -
Goal: For each date, create 2 new variables (e.g. 'LSum' and 'USum'). 'LSum' should calculate the sum of all cell values across the columns (4-281), but only with those values whose header is in the cell array of ABC.L, for that specific date. In the same fashion, 'USum' should calculate the sum of all cell values across the columns, but only with those values whose header is in the cell array of ABC.U, for that specific date.
- - -
How I would start:
load ('ABC.mat');
for row=1:size(ABC,1);
LSum = sum();
USum = sum();
end;
ABC = [ABC(:,1:3) LSum USum ABC(:,3+1:end)];
- - -
Thanks in advance for your help, especially for the looping through date and the cell arrays of 'L' and 'U' at the same time.
0 Comments
Sign in to comment.