putting some matrix in a cell arrays

13 visualizaciones (últimos 30 días)
Ameni JOUILA
Ameni JOUILA el 23 de Sept. de 2017
Comentada: Stephen23 el 23 de Sept. de 2017
I have 3 matrices:
m1[5x4];
m2[5x4];
m3[5x3];
I want to put them in a cell W{i}
for i=1:3
in a way W{1}=m1; W{2}=m2 and W{3}=m3
How could I do it? Thx
  1 comentario
Stephen23
Stephen23 el 23 de Sept. de 2017
You already did:
W{1}=m1;
W{2}=m2;
W{3}=m3;
While there are ways of doing this in a loop, you should learn to write code without using such slow and buggy methods:

Iniciar sesión para comentar.

Respuestas (2)

Guillaume
Guillaume el 23 de Sept. de 2017
After the fact:
W = {m1, m2, m3};

Star Strider
Star Strider el 23 de Sept. de 2017
‘How could I do it?’
You just did it!
W{1}=m1;
W{2}=m2;
W{3}=m3;

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by