Borrar filtros
Borrar filtros

How to reshape a matrix?

1 visualización (últimos 30 días)
Badavath Purnesh Singh
Badavath Purnesh Singh el 10 de Nov. de 2021
Comentada: Walter Roberson el 11 de Nov. de 2021
I have a matrix of size 9*10. I want each row of the matrix get converted into a 2D matrix, like 3*3 and the coloumns which represent the number of observations, which are 10. At the end I want a 3D matrix, comprising 3*3 matrix, which will represent my data points for a particilar observation and the other dimention in coloumns should be of 10, representing the number of obsverations.

Respuesta aceptada

Walter Roberson
Walter Roberson el 10 de Nov. de 2021
Array3D = reshape(Array2D, 3, 3, []);
  5 comentarios
Badavath Purnesh Singh
Badavath Purnesh Singh el 11 de Nov. de 2021
@Walter Roberson Im so sorry, I have failed to convey the problem clearly. I have a matrix of 10*9 matrix, in which each row has 9 elements and each row represents one observation. So basically i need my elements(9) in each row to be a 2D matrix of 3*3. I hope I have explained clearly. I'll try the above mentioned line of code by you. if the problem isnt solved, ill reach out to you. Thank you so much.
Thank you so much for pointing out my mistake in explanning my issue.
Walter Roberson
Walter Roberson el 11 de Nov. de 2021
Array3D = permute(reshape(Array2D, [], 3, 3), [3 2 1]);

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Type Conversion en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by