MATLAB Answers


single row matrix vector subtraction

Asked by PK
on 23 Oct 2012

i require the following calculation but my trial failed hope some one can help in this i have two matrices best=1x100 matrix and WIN=10x100 matrix and my problem is to subtract every row of WIN matrix with singe row matrix best i have used for loop but finally its giving one 1x100 ie., only 10th row but i require all the 10 rows ie 10x100 matrix after subtraction in a single variable



No products are associated with this question.

2 Answers

Answer by Andrei Bobrov
on 23 Oct 2012
 Accepted answer

out = bsxfun(@minus,WIN,best);


on 23 Oct 2012

hello u have given as bsxfun(@minus,WIN,best); can u pls tell what these type of functions are called as

please read about function bsxfun

Answer by PG
on 23 Oct 2012


Join the 15-year community celebration.

Play games and win prizes!

Learn more
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!