How to replace first and last element of each matrix in 7x1 cell with 0
2 views (last 30 days)
I have a 7x 1 cell of 101x1 double.
I want to replace first and last element of each matrix with 0. Can you help please?
for i = 1:length(cell)
Unable to use a value of type cell as an index.
More Answers (1)
Walter Roberson on 18 Jul 2022
NewCell = cellfun(@(C) [0; C(2:end-1); 0], OldCell, 'uniform', 0);
Note: using cell as the name of a variable interfers with calling cell() to create a cell array... and confuses people reading your code.