About trasfor two dimensions to three dimensions

2 Ansichten (letzte 30 Tage)
min wong
min wong am 9 Okt. 2016
Beantwortet: Marc Jakobi am 9 Okt. 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

Akzeptierte Antwort

Marc Jakobi
Marc Jakobi am 9 Okt. 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]);

Weitere Antworten (0)

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by