Index exceeds matrix dimensions error
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
reza hamzeh
il 12 Gen 2020
Modificato: Stijn Haenen
il 12 Gen 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 Commenti
Risposta accettata
Stijn Haenen
il 12 Gen 2020
Modificato: Stijn Haenen
il 12 Gen 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 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Matrix Indexing in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!