Multiple outputs from a for loop
Mostrar comentarios más antiguos
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 comentarios
Stephen23
el 21 de Jun. de 2022
"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
el 21 de Jun. de 2022
Already you have that in hand.
z(1), z(2),...z(n) etc.,
Roger Kalvig
el 21 de Jun. de 2022
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Numerical Integration and Differentiation en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

