Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

this code shows error?

1 visualización (últimos 30 días)
Dhines
Dhines el 26 de Feb. de 2013
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
S=S(1:f-1,f+1:length(S))
,,,, error:?? Index exceeds matrix dimensions.

Respuestas (2)

Walter Roberson
Walter Roberson el 26 de Feb. de 2013
Yes, that would occur if S is not two-dimensional and at least f-1 elements in the first dimension and length(S) elements in the second dimension.
Are you possibly trying to remove element #f from S? If so then
S(f) = [];
or
S = S([1:f-1, f+1:numel(S)]);

Jan
Jan el 26 de Feb. de 2013
Another guess:
Did you define "length" as a variable? Then "length(S)" might fail. Test this by:
dbstop if error
% start the code until Matlab stops at the problem. Then:
which length
  2 comentarios
Dhines
Dhines el 26 de Feb. de 2013
it is variable sir. i defined it. length value is 50
Jan
Jan el 27 de Feb. de 2013
Defining "length" as a variable is a bad idea, because you cannot use the command length() afterwards. If "length" is 50, it has a single element only. Then "length(S)" must fail if S has any value different from 1.

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by