How can I split one large matrix to struct with several fields?

 Respuesta aceptada

Matt J
Matt J el 22 de Mzo. de 2022
Editada: Matt J el 22 de Mzo. de 2022
M=rand(100,20);
Mcell=num2cell(permute(reshape(M,[10,10,20]),[1,3,2]),[1,2]);
cell2struct(Mcell, "f"+(1:10),3)
ans = struct with fields:
f1: [10×20 double] f2: [10×20 double] f3: [10×20 double] f4: [10×20 double] f5: [10×20 double] f6: [10×20 double] f7: [10×20 double] f8: [10×20 double] f9: [10×20 double] f10: [10×20 double]

Más respuestas (0)

Categorías

Etiquetas

Preguntada:

el 22 de Mzo. de 2022

Editada:

el 22 de Mzo. de 2022

Community Treasure Hunt

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

Start Hunting!

Translated by