How can i form a 3d matrix from a 2d matrix
Show older comments
Hello I am struck in a problem for long time. I have got a 2D matrix of size 19x1339. I have another parameter pi=p*ch*win. Where p=1;ch=21;win=56. I wish to make a 3D matrix of dimension pi x 19 x 1339 without inserting zeros in the matrix. Can anyone please help me? It is really very urgent. I am doing the following: Here WCOH and WCS have the dimension 19 x 1339.
pi=p*ch*win;
xcoh(pi,:,:)=WCOH;%ADD coherence feature for each window here
xcs(pi,:,:)=WCS;
3 Comments
KL
on 10 May 2017
Your 2D matrix has 19x1339 elemets and you want to create a 3D matrix with 112x19x1339 elements without inserting zeros into it? What do you want to have in the 3D matrix then?
Arijit Ghosh
on 10 May 2017
Answers (1)
Jan
on 10 May 2017
Perhaps you mean:
xcs = repmat(reshape(WCS, 1, 19, 1339), 1176, 1, 1);
But this 3D array would consist of 1176 identical slices and this redundancy would be really inefficient.
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!