Borrar filtros
Borrar filtros

Index exceeds matrix dimensions error

1 visualización (últimos 30 días)
reza hamzeh
reza hamzeh el 12 de En. de 2020
Editada: Stijn Haenen el 12 de En. de 2020
hi. plz help me to fix this error.
t{1}=0;
for n=1:10
if n/2>2
t{n}=t{n}+1
end
end
% error: Index exceeds matrix dimensions.

Respuesta aceptada

Stijn Haenen
Stijn Haenen el 12 de En. de 2020
Editada: Stijn Haenen el 12 de En. de 2020
You should use ( and ) not { and }.
Try this code:
t=zeros(10,1);
for n=1:10
if n/2>2
t(n)=t(n-1)+1
end
end

Más respuestas (0)

Categorías

Más información sobre Matrix Indexing 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