Create 3d matrix from existing 2d matrix in Matlab

2019-09-02 17:02发布

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

3条回答
劫难
2楼-- · 2019-09-02 17:19

Use:

permute(matrix,[1 3 2])

switches 2nd and 3rd dimensions

查看更多
太酷不给撩
3楼-- · 2019-09-02 17:31

Try

reshape(matrix,64,1,727)

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

查看更多
叼着烟拽天下
4楼-- · 2019-09-02 17:31

Try this:

x2d = rand(64, 727);
x3d = reshape(x2d, 64, 1, 727);
查看更多
登录 后发表回答