matrix columnwise subtraction

 Respuesta aceptada

Image Analyst
Image Analyst el 25 de Nov. de 2011

1 voto

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 comentarios

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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Preguntada:

el 25 de Nov. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by