Subtracting matrices by column
Ältere Kommentare anzeigen
Hi guys!
I have two matrices for e.g.:
A = [1:5;6:10]; B = [100;200]
I need to subtract each column of A from B. How do I accomplish that?
I know there's one way to first repeat matrix B 5 times and then work out normal addition but I don't wish to do that way. Any help here? :)
Thanks
Antworten (1)
Fangjun Jiang
am 16 Nov. 2011
0 Stimmen
bsxfun(@minus,A,B)
Kategorien
Mehr zu Elementary Math finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!