Iterating over Columns/Rows (no index)

3 次查看(过去 30 天)
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

回答(1 个)

Yongjian Feng
Yongjian Feng 2021-11-21
编辑:Yongjian Feng 2021-11-21
If the array is a row vector, then it works
a = [1 2 3]
for i = a
disp(i)
end

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

标签

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by