简体   繁体   中英

How to create a 3D matrix with third dimension equal one in matlab

I want to create a 3D matrix of (MxNx1) dimension. where third dimension is equal to 1. I am trying something like zeros(M,N,1) but it is returning a matrix of (MxN) dimension instead of (MxNx1) dimension. Is there any way of creating a 3D matrix where third dimension equal to 1.

How do you process a MxNxD image? I could only image that the useage of the third dimension is:

[M,N,D] = size(your3DMatrix);

Then you use D for further coding. Another possible useage is

permute(your3DMatrix,[n1 n2 n3])

Anyway, these both work fine for matrix whose third dimension is 1.

If you detail your code dealing with the MxNx1 matrix, it would be easier to help you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM