Date: Nov 19, 2012 12:20 AM
Author: Steven Lord
Subject: Re: Subtract values in a matrix
"Bob Ferreira" <email@example.com> wrote in message
> Hi there!
> I need really need some help on this,
> I have a matrix which has "L" lines and "C" columns. I want to subtract
> each value in the matrix by the value the first value in the first line of
> its column, and give me a matrix with those value, with the first values
> of the first line being "0".
> Example: m = [2,2,2;3,3,3;4,4,4] the matrix given should be
> I hope I made myself understood, if not, please ask away.
> Thank you for your time.
m = [2,2,2;3,3,3;4,4,4];
m2 = bsxfun(@minus, m(1, :), m)
To contact Technical Support use the Contact Us link on