How to fix "cell contents assignment to a non-cell array object" error?
Show older comments
for z=1:10;
w=blabla;
m=1;
for i=1:length(new{z});
for j=1:4;
new[z+1]{m}.x1=rand(w);
new[z+1]{m}.x2=rand(w);
m=m+1;
Answers (1)
James Tursa
on 23 Feb 2017
Not sure what you are trying to do here. tr is a cell array:
tr={1,2,3,4,5,6}
So accessing the contents of tr would either be with curly braces { } to get at the contents of the cell(s), or with parentheses ( ) to get at a subset of the cell array. I.e.,
tr{1} is the double scalar 1.0
tr(1) is a 1x1 cell array whose only element contains a double scalar with value 1.0
So what is this notation supposed to do for you:
tr[t+1]{k}.wind=rand;
You've got square brackets [ ] used inappropriately, as well as using the .wind notation to indicate that you are working with a structure, which you are not. Can you explain in more detail what you are trying to do here, and what the resulting cell array or structure is supposed to look like?
Categories
Find more on Data Types in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!