I want to manipulate a cell array and make certain indices of the cell array contain the empty matrix []
. I can't seem to figure out how to do this:
>> yy=num2cell(1:10)
yy =
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10]
>> yy{1:2:end}=[]
??? The right hand side of this assignment has too few values to satisfy
the left hand side.
>> yy(1:2:end) = []
yy =
[2] [4] [6] [8] [10]
Bah! Can't seem to do what I want. I want to leave empty elements in the cell array, e.g.
[] [2] [] [4] [] [6] [] [8] [] [10]
Any suggestions? My index vector could be arbitrary, and either in index form or boolean form, not necessarily [1 3 5 7 9].