Subtracting the first element of each row from the rest of the row ?

3 views (last 30 days)
Hi all,
I have a matrix like A=[3.5,4.5;2.4,3.2]. I want to subtract the first element of each row from the rest of the row resulting in [0,1.5;0,0.7].
Many thanks !

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 21 Feb 2014
A=[3.5,4.5;2.4,3.2];
out = bsxfun(@minus,A,A(:,1));

More Answers (0)

Categories

Find more on Elementary Math in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!