How to do: "for each value of the vector A"
조회 수: 60 (최근 30일)
이전 댓글 표시
Hi all,
i'd like to know how is possible to get the iteration for each element of a vector. I show an example.
A=[14 5 7 3 8];
for i=each element of A
etc
end
Thanks to all will answer me.
댓글 수: 0
답변 (1개)
madhan ravi
2019년 9월 14일
for ii = 1:numel(A) % this is for illustration purposes
A(ii)
end
댓글 수: 4
Stephen23
2019년 9월 15일
Note that in most real-world code, looping over indices (as per madhan ravi's original answer), is much more useful.
Robin Amar
2021년 12월 23일
This operation is straight forward in Python as well.
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!