How to: taking out 2d matrix from 3d matrix
Afficher commentaires plus anciens
Hello All, I need help in 3d matrix. I have z as 2x20x30 matrix which I will represnt here as:
z(i,m,n)
Now I want to take out z1 as (m,n) and z2 as (m,n) matrix from this. Meaning the i from z(i,m,n) is i=1:2. So z1 will be (m,n) when i=1 and z2 will be (m,n) when i=2
What I did is:
z1(m,n)=z(1,m,n)
z2(m,n)=z(2,m,n)
But this yields only 1 value and rest of z1 matrix values turns out as zero.
I am not sure how to pull this out. Can anyone help me? I hope you understand my problem. Regards, Adwait
Réponse acceptée
Plus de réponses (1)
Azzi Abdelmalek
le 19 Mai 2016
z=randi(4,4,3,2)
A=permute(z,[2 3 1])
z1=A(:,:,1)
z2=A(:,:,2)
1 commentaire
adi kul
le 19 Mai 2016
Catégories
En savoir plus sur Univariate Discrete Distributions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!