- your a(i)< is for i=0:10. Matlab starts with an index of 1
- same thing for a(n).
- a(i==10) will also give you an error since there are not 10 indexes in a.
Info
この質問は閉じられています。 編集または回答するには再度開いてください。
while run the following matlab program i am geting error as Index exceeds matrix dimensions.please tell me where i did wrong.
1 回表示 (過去 30 日間)
古いコメントを表示
a=[9 4 9 3 9 1 9 0]
binsize=9/10;
if (n<10)
for n=0:10
count=0
for i=0:10
if cond(n*binsize<a(i))
if a(i)<(n+1)*binsize
counts(n)=counts(n)+1;
a(n)=n+1
end
end
end
end
end
1 件のコメント
Joseph Cheng
2015 年 9 月 14 日
there are several things wrong with your statements.
回答 (1 件)
Renato Agurto
2015 年 9 月 14 日
編集済み: Renato Agurto
2015 年 9 月 14 日
Hello, I'm not sure if the order of the command you posted is right or complete: e.g. "if (n<10)" statement is before n is defined.
At a first look i guess the problem is that you have "for i = 0:10". If i is the index for a, which has length 8, you will get error when tryng to evaulatue a(i) with, i = 0, i = 9 and i = 10.
I hope this helps
0 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!