Subtracting matrices by column

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

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2011년 11월 16일

0 개 추천

bsxfun(@minus,A,B)

카테고리

도움말 센터 및 File Exchange에서 Elementary Math에 대해 자세히 알아보기

질문:

2011년 11월 16일

Community Treasure Hunt

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

Start Hunting!

Translated by