フィルターのクリア

Attempted to access B(25,1); index must be a positive integer or logical.

1 回表示 (過去 30 日間)
Sameer
Sameer 2014 年 5 月 13 日
編集済み: Andreas Goser 2014 年 5 月 13 日
rowsCI = rows(swtCI);
B = sort(PQMatx(:,3)); h=1; while h<=rowsCI; UB=(1-swtCI(h,1)); UBB=UB/2; UBBB=1-UBB; UBBBB = UBB*swtN; J = B(UBBBB,1); disp('Upper Bound for swtCI(i,1)'); disp(J); M = B((((1-swtCI(h,1))/2)*swtN),1); disp('Lower Bound for swtCI(i,1)'); disp(M); h=h+1; end;
this is my code. why cant matlab access and display negative numbers?

回答 (1 件)

Andreas Goser
Andreas Goser 2014 年 5 月 13 日
編集済み: Andreas Goser 2014 年 5 月 13 日
It is not about "access and display negative numbers", it is about the indices. Like you would try to access B(-1) or B(1.2).
Verify the values with in the B(<value>) brackets. When you put this in a script and not execute from the command line, you also get a line number where to debug.

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by