Multiply each slice of 3d matrix with 2d matrix

8 Ansichten (letzte 30 Tage)
Christoph
Christoph am 15 Mär. 2014
Kommentiert: neda rojhani am 10 Mär. 2017
Hi,
I have to matrices: A=11x10x32 B=32x8760
I want to ultiply each 11x10x1 slice of matrix A with Matrix B.
What's the best way to to this?
Thank you so much!
  3 Kommentare
Christoph
Christoph am 15 Mär. 2014
I'm sorry for the confusion.
I ment each (1x1x32) by (32x8760).
Image Analyst
Image Analyst am 15 Mär. 2014
Really? This is the correction? OK, now I'll ask, how are you going to multiply a 3 dimensional 1x1x32 column vector by a 2 dimensional 32x8760 matrix?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 15 Mär. 2014
A=rand(11,10,32);
b=rand(32,8760);
AA=permute(A,[1 3 2])
for k=1:size(AA,3)
out{k,1}=AA(:,:,k)*b;
end
out1=cell2mat(out)
  3 Kommentare
Azzi Abdelmalek
Azzi Abdelmalek am 15 Mär. 2014
No, the size of out1 is 110x8760
neda rojhani
neda rojhani am 10 Mär. 2017
Hi, I have problem after finding out1. if I would like to convert the result to the mentioned matrix(A(11 * 10 *32) What should I do?

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by