Index exceeds matrix dimensions error
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
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.
0 comentarios
Respuesta aceptada
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
0 comentarios
Más respuestas (0)
Ver también
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!