Borrar filtros
Borrar filtros

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

1 visualización (últimos 30 días)
Sameer
Sameer el 13 de Mayo de 2014
Editada: Andreas Goser el 13 de Mayo de 2014
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?

Respuestas (1)

Andreas Goser
Andreas Goser el 13 de Mayo de 2014
Editada: Andreas Goser el 13 de Mayo de 2014
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.

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by