How to extract cell array of 2D matrices into a timeseries?
I have some data that is stored as a 1666×1 cell array. Each cell contains a 4×19 double. I need to extract this data and attach it to a timeseries object. Timeseries will not take a cell array directly, so I need to extract the cells.
So let’s say the cell array is named data, and the timeseries is ts. I need:
ts.Data(1) = data{1}
ts.Data(2) = data{2}
etc.
cell2mat() concatenates everything into 6664×19, and I can’t get reshape() to chop it up into the correct 4×19 blocks. I could do it in a for loop, but that’s not very satisfying in MATLAB.
I know this is a simple syntax thing, but I can’t seem to find an answer that works.I have some data that is stored as a 1666×1 cell array. Each cell contains a 4×19 double. I need to extract this data and attach it to a timeseries object. Timeseries will not take a cell array directly, so I need to extract the cells.
So let’s say the cell array is named data, and the timeseries is ts. I need:
ts.Data(1) = data{1}
ts.Data(2) = data{2}
etc.
cell2mat() concatenates everything into 6664×19, and I can’t get reshape() to chop it up into the correct 4×19 blocks. I could do it in a for loop, but that’s not very satisfying in MATLAB.
I know this is a simple syntax thing, but I can’t seem to find an answer that works. I have some data that is stored as a 1666×1 cell array. Each cell contains a 4×19 double. I need to extract this data and attach it to a timeseries object. Timeseries will not take a cell array directly, so I need to extract the cells.
So let’s say the cell array is named data, and the timeseries is ts. I need:
ts.Data(1) = data{1}
ts.Data(2) = data{2}
etc.
cell2mat() concatenates everything into 6664×19, and I can’t get reshape() to chop it up into the correct 4×19 blocks. I could do it in a for loop, but that’s not very satisfying in MATLAB.
I know this is a simple syntax thing, but I can’t seem to find an answer that works. timeseries, matrix, cell MATLAB Answers — New Questions