Iterating over Columns/Rows (no index)

3 vues (au cours des 30 derniers jours)
Jan Kager
Jan Kager le 21 Nov 2021
Modifié(e) : Yongjian Feng le 21 Nov 2021
Standard way to iterate over matrix columns or rows is to use an incrementing iterator and index the matrix from there.
Are there alternative ways to do this?
Similar to iterating over vector values, like this:
for value = some_vector
...
end

Réponses (1)

Yongjian Feng
Yongjian Feng le 21 Nov 2021
Modifié(e) : Yongjian Feng le 21 Nov 2021
If the array is a row vector, then it works
a = [1 2 3]
for i = a
disp(i)
end

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Tags

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by