I want to manipulate an array of cells and make certain indices of the array of cells contain an empty matrix []. I cannot 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! I can't seem to do what I want. I want to leave empty elements in an array of cells, e.g.
[] [2] [] [4] [] [6] [] [8] [] [10]
Any suggestions? My index vector can be arbitrary and either in index form or in the form of a Boolean, not necessarily [1 3 5 7 9].
source
share