I have the following table: Table
Columns 'L' and 'U' if the table consist of cells that contain object names that correspond to the headers in columns 4-281. Example
Goal: For every date verify what objects are in 'L' (respectively 'U') and sum the aggregate of those objects' 4-point trailing moving sum and its standard deviation (going up in the table!) and store it in a new variable, e.g. LSum and LStd for 'L' as well as USum and UStd for 'U'. For dates with insufficient values, e.g. 15-Jul-2016 with only 3 instead of 4 time steps ahead, return NaN's.
How I would start:
for row=1:size(ABC,1)
row_values = ABC{row,:};
row_values = row_values(4:end);
% How to make the loop for columns L and U where there are multiple objects in one cell?
% How can I use 'movsum' and 'movstd' here to calculate values vertically going up?
end;
Thanks a lot for your help!
Maybe you could use the functions
cell2mat
andcellfun
to achieve your goal.With these functions you can:
Convert your cell matrix to a double matrix in order to perform (
cell2mat
)Perform a certain operation on all cell elements (
cellfun
)