필터 지우기
필터 지우기

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 CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by