About trasfor two dimensions to three dimensions

1 vue (au cours des 30 derniers jours)
min wong
min wong le 9 Oct 2016
I want to ask a simple question,but I just can't solve it.
My data follow below
A=(23*25). B=(23*25)
Then I want to change A & B to C=(6*23*25)
The c(1,:,:),c(2,:,:)and c(3,:,:)are A
The c(4,:,:),c(5,:,:)and c(6,:,:)are B
How can I use loop or something to make it happen?
Thanks

Réponse acceptée

Marc Jakobi
Marc Jakobi le 9 Oct 2016
I assume 23*25 are the dimensions of the matrices?
You could do something like this:
c = zeros(6, 23, 25);
c(1:3,:,:) = permute(repmat(A,1,1,3),[3,1,2]);
c(4:6,:,:) = permute(repmat(B,1,1,3),[3,1,2]);

Plus de réponses (0)

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by