フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

can anybody help me with this error???

1 回表示 (過去 30 日間)
Sony
Sony 2013 年 5 月 23 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
x1=sortrows(xf,2);
p=round(x1);
classes=20;
array=zeros(size(classes),3)
min1=min(p(:,2));
max1=max(p(:,2));
classwidth=(max1-min1)/classes;
d=ceil(classwidth);
sum=0; j=1;k=1;n=0;
lowerlimit=min1:d:max1;
cw=d-1;
upperlimit=cw+lowerlimit;
ll=lowerlimit';
ul=upperlimit';
for k=1:classes
for i=1:size(p)
if p(i,2)>=ll(k) && p(i,2)<=ul(k)
sum=sum+p(i,1);
end
end
array(k,1)=sum;
array(k,2)=ll(k);
array(k,3)=ul(k);
sum=0;
end
The error is in this line
Index exceeds matrix dimensions.
Error in ==> if p(i,2)>=ll(k) && p(i,2)<=ul(k)
  3 件のコメント
Jan
Jan 2013 年 5 月 23 日
Please use meaningful tags. Of course all questions in a Matlab forum concern "matlab".
Sony
Sony 2013 年 5 月 23 日
size of x1 and xf is 63 rows and 2 columns

回答 (1 件)

Jan
Jan 2013 年 5 月 23 日
編集済み: Jan 2013 年 5 月 23 日
You can use the debugger to check, what's going on:
dbstop if error
Then start the program again. When Matlab stops at the error inspect the values of i and k as well as the sizes of p, ll and ul.
It is not possible in theory that we can fix the problem, because all we have is the failing code, but we cannot guess its intention reliably.

この質問は閉じられています。

タグ

タグが未入力です。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by