Iterating over Columns/Rows (no index)

조회 수: 4 (최근 30일)
Jan Kager
Jan Kager 2021년 11월 21일
편집: Yongjian Feng 2021년 11월 21일
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