Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Store each array values that I got using a for loop in different variables.

2 visualizaciones (últimos 30 días)
Vellan
Vellan el 4 de Dic. de 2019
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
Hello,
I would like to store each array values that I got using a for loop in different variables. This was the code that I used.
function ret=poly_prod(P1,P2)
n=poly_row(P1)
m=poly_row(P2)
a=size(n)
b=size(m)
for n=1:b(2)
ret=P1*P2(n)
end
end
I got an answer like this,
ret =
3 3 -21 -45
ret =
-1 -1 7 15
ret =
2 2 -14 -30
R =
2 2 -14 -30
I am expecting the output to be like, for example
g = 3 3 -21 -45
h= -1 -1 7 15
i= 2 2 -14 -30
Thank you.
  1 comentario
Stephen23
Stephen23 el 4 de Dic. de 2019
Editada: Stephen23 el 4 de Dic. de 2019
"I would like to store each array values that I got using a for loop in different variables"
That would not be a good approach.
Using one array and indexing would be much simpler and more efficient.

Respuestas (0)

La pregunta está cerrada.

Community Treasure Hunt

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

Start Hunting!

Translated by