Multiple outputs from a for loop
이전 댓글 표시
Basic problem, but I can't find the solution:
consider basic a for loop:
for i = 1:5
z(i)=3*i
end
It produces a vector z= [3 6 9 12 15]. What I need is all the components of the vector z as a sperate variables(scalars), let,s say
z1=3, z2=6 and so on. How can I do that?
Thanks in advance
Roger Kalvig
댓글 수: 4
Stephen23
2022년 6월 21일
"What I need is all the components of the vector z as a sperate variables(scalars)"
Why?
What do you imagine that you can do with lots of scalars, that is not possible using indexing?
"say z1=3, z2=6 and so on."
KSSV
2022년 6월 21일
Already you have that in hand.
z(1), z(2),...z(n) etc.,
Roger Kalvig
2022년 6월 21일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

