Flatten Matrix in Row Major Order in Arbitrary Dimensions
42 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Lucas-Raphael Müller
el 12 de Jun. de 2019
Respondida: David Goodmanson
el 15 de Jun. de 2019
Hey there,
is there a canonical way on how to flatten a arbitrarily high dimensional matrix in C order (i.e. row major, or last index first)? All I can find is for 2D which is comparably easy.
Cheers,
0 comentarios
Respuestas (1)
David Goodmanson
el 15 de Jun. de 2019
Hello Lucas-Raphael,
I'm not sure this is what you are looking for, but
B = permute(A,[6 5 4 3 2 1]); % (however many dimensions there are)
B = B(:);
has a lot of the right properties.
0 comentarios
Ver también
Categorías
Más información sobre Matrix Indexing 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!