Error using + Matrix dimensions must agree
Show older comments
RGB=real(DFT)+WMI;
6 Comments
Mostfa Abd El-Aziz
on 8 Nov 2021
Chunru
on 8 Nov 2021
What are the sizes of DFT and WMI? Show the result of running "whos" in matlab.
Steven Lord
on 8 Nov 2021
What do the following commands show immediately before you execute that line of code?
size(DFT)
size(real(DFT))
size(WMI)
Voss
on 8 Nov 2021
My guess would be that the dimensions of matrices DFT and WMI do not agree.
Steven Lord
on 8 Nov 2021
Yes, I agree that likely the dimensions don't agree. Seeing the size of each array may give us some insight into what the cause of that discrepancy may be and suggest a solution. For instance, if both are vectors but one is one element shorter I'd ask if they called diff to create the shorter vector. If one is a vector and the other has the same number of elements but is a different shape, calling reshape may be what the poster wants.
Mostfa Abd El-Aziz
on 9 Nov 2021
Answers (1)
yanqi liu
on 9 Nov 2021
RGB=real(DFT)+imresize(WMI,[size(DFT,1) size(DFT,2)], 'bilinear');
4 Comments
Mostfa Abd El-Aziz
on 9 Nov 2021
yanqi liu
on 9 Nov 2021
RGB=real(DFT(:,:,1))+imresize(WMI(:,:,1),[size(real(DFT(:,:,1)),1) size(real(DFT(:,:,1)),2)], 'bilinear');
Mostfa Abd El-Aziz
on 9 Nov 2021
yanqi liu
on 10 Nov 2021
yes, sir, may be upload mat file to analysis
Categories
Find more on Creating and Concatenating 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!