Multiply Matrix with column of different sizes
1 view (last 30 days)
Show older comments
how to multiply matrices with columns of different size. Example: Matrix A = (A1, A2) with dim A1 = 240x1 dual and A2 = 300x1 Double.
0 Comments
Answers (3)
Image Analyst
on 13 Jul 2013
What are you going to multiply by A? I know what double is, but what data type is "dual"? Why do you want to multiply two matrices together when that doesn't follow the normal rules of matrix multiplication as far as the number of columns of the left matrix matching the number of rows in the second matrix? Maybe you should call interp2() or imresize() to resize one of the matrices before multiplication.
0 Comments
Azzi Abdelmalek
on 13 Jul 2013
%Example
A1=rand(240,1)
A2=rand(300,1)
%----The code--------
n=240;
out=A2;
out(1:n)=A1.*A2(1:n)
0 Comments
See Also
Categories
Find more on Resizing and Reshaping Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!