Matlab Indexing Error A(I) = B
情報
この質問は閉じられています。 編集または回答するには再度開いてください。
古いコメントを表示
Hi. I am new to matlab and have this error I can't quite figure out. Here's the code:
clear all
clc
h = 12.5;
l = 12;
L = 16;
m = pi/10:pi/10:2*pi;
n = length(m);
d_plot = zeros(1,n);
for i = 1:n
d = acos((L*cos(m) - h)/l);
d_plot(i) = d;
end
The error says: In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in ==> test2 at 12 d_plot(i) = d;
Will appreciate it if someone could point out the error for me. Thanks in advance
1 件のコメント
Walter Roberson
2013 年 4 月 4 日
Each time through the "for i" loop, you are calculating exactly the same thing. Why is that?
回答 (0 件)
この質問は閉じられています。
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!