use the mat2cell function

Now i have a 5*100 matrix, how to convert it to a 5*10 cell and each cell contain 1*10?

Respuestas (2)

David Hill
David Hill el 23 de Mzo. de 2021

0 votos

b=mat2cell(a,[1 1 1 1 1],[[10 10], [10 10], [10 10], [10 10], [10 10]]);
Star Strider
Star Strider el 23 de Mzo. de 2021

0 votos

Try this:
A = randi(9, 5, 100); % Create Matrix To Test Code
C = mat2cell(A, ones(5,1), ones(1,10)*10) % Desired Result
.

Categorías

Más información sobre Data Type Conversion en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 23 de Mzo. de 2021

Respondida:

el 23 de Mzo. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by