Iterating over Columns/Rows (no index)

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일

0 개 추천

If the array is a row vector, then it works
a = [1 2 3]
for i = a
disp(i)
end

카테고리

도움말 센터File Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

제품

릴리스

R2021b

태그

질문:

2021년 11월 21일

편집:

2021년 11월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by