I have 3x2 cell array called signals
. All cells contain a 8x6xN array full of integers. I am trying to move down every row by one row and overwrite the first row with NaNs. Howevery, I am struggling with the correct syntax regarding indexing. I am able to manipulate one particular cell like this:
signals{1,1}(2:end, :) = signals{1,1}(1:end-1, :);
signals{1,1}(1,:) = NaN;
How can I apply this manipulation to the whole cell array? I am basically looking for something like this:
signals{:}(2:end, :) = signals{:}(1:end-1, :);
You need to loop through each element in the cell array and perform the operation on each of these elements.
for k = 1:numel(signals)
signals{k}(2:end, :) = signals{k}(1:end-1, :);
signals{k}(1,:) = NaN;
end