matrix columnwise subtraction

 Risposta accettata

Image Analyst
Image Analyst il 25 Nov 2011
Try bsxfun:
% Generate sample data.
m = rand(3,5)
% Extract out the first column
m1 = m(:,1)
% Subtract first column from all the columns.
mMinusM1 = bsxfun(@minus,m,m1)

2 Commenti

Small typo, to reproduce the example you need to subtract m from m1: m1MinusM = bsxfun(@minus, m1, m).
zozo
zozo il 26 Nov 2011
thank you!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su MATLAB in Centro assistenza e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by