필터 지우기
필터 지우기

How to do: "for each value of the vector A"

조회 수: 60 (최근 30일)
AlexDp
AlexDp 2019년 9월 14일
댓글: Robin Amar 2021년 12월 23일
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.

답변 (1개)

madhan ravi
madhan ravi 2019년 9월 14일
for ii = 1:numel(A) % this is for illustration purposes
A(ii)
end
  댓글 수: 4
Stephen23
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
Robin Amar 2021년 12월 23일
Thanks for the 2nd Suggestion @madhan ravi. I wanted precisely this answer.
This operation is straight forward in Python as well.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by