Create 3d matrix from existing 2d matrix in Matlab

萝らか妹 提交于 2019-12-11 20:09:17

问题


I have a 2D matrix of dimensions 64 x 727. What I would like to do is separate each of the columns, creating a 3D matrix of dimensions 64 x 1 x 727.

I have looked through several similar questions on here, but my limited matlab ability is preventing me from applying previous answers to my own issue.

Many thanks,

Robbie


回答1:


Try

reshape(matrix,64,1,727)

if that doesn't produce what you want explain further.




回答2:


Try this:

x2d = rand(64, 727);
x3d = reshape(x2d, 64, 1, 727);



回答3:


Use:

permute(matrix,[1 3 2])

switches 2nd and 3rd dimensions



来源:https://stackoverflow.com/questions/11025255/create-3d-matrix-from-existing-2d-matrix-in-matlab

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!