I got an error in my program while making clusters in first box P1(1,1).........plz make change in my program to form clusters in first box.......
2 次查看(过去 30 天)
显示 更早的评论
i got an error: In an assignment A(I) = B, a matrix A cannot be resized.
Error in grid11 (line 234) X(cluster)=leach(q).x_position;
0 个评论
回答(1 个)
Walter Roberson
2016-10-27
In newer versions, the error report is "attempt to grow array along ambiguous dimension"
Early in the code you use
[X,Y] = meshgrid(x);
x is length 3 so your X and Y end up as 3 x 3.
Then later in your code you try to use X as having to do with your cluster positions. But because you initialized it as 3 x 3, when you use X(cluster) that is linear indexing into the 3 x 3 array. Eventually you try to assign to X(10) and that fails because it cannot figure out how to assign to the 10th linear element of a 3 x 3 array.
You should be using "clear X Y" before you reach the section where you attempt to assign to X by cluster.
You re-used a variable name for a different purpose and then you got surprised when the remaining size of the old purpose did not agree with the shape needed for the new purpose.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!