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!

