Use for loop in array
Afficher commentaires plus anciens
How to use the for loop in array with a start value of 0?
Réponses (1)
KSSV
le 10 Juin 2019
a = rand(10,1) ;
for i = 1:length(a)
a(i)
end
6 commentaires
hang dong
le 10 Juin 2019
KSSV
le 10 Juin 2019
No..MATLAB does not accept index as zero. It should be positive integer.
hang dong
le 10 Juin 2019
KSSV
le 10 Juin 2019
What is your purpose? Explain your problem.
hang dong
le 10 Juin 2019
KSSV
le 10 Juin 2019
You can get the index of 0 using
idx = find(a==0)
Catégories
En savoir plus sur Matrices and Arrays dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!