3d to 2d matrix

4 visualizaciones (últimos 30 días)
Paulo Eduardo Beiral
Paulo Eduardo Beiral el 22 de Jun. de 2021
Comentada: Joseph Cheng el 22 de Jun. de 2021
I need to convert this "u" 3d matrix in a 2d numerical matrix, without having to cut and paste number by number in a new one, just like the "u2" example.
Thank you for any help!

Respuesta aceptada

Joseph Cheng
Joseph Cheng el 22 de Jun. de 2021
take a look at the function squeeze()
for ind = 1:3
val(1,1,ind)=-ind;
end
disp(val)
(:,:,1) = -1 (:,:,2) = -2 (:,:,3) = -3
u2 = squeeze(val);
disp(u2)
-1 -2 -3
  2 comentarios
Paulo Eduardo Beiral
Paulo Eduardo Beiral el 22 de Jun. de 2021
Thank you!
Joseph Cheng
Joseph Cheng el 22 de Jun. de 2021
if the starting matrix is a bit more complicated you can also use reshape() as well

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

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

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by