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

3 Ansichten (letzte 30 Tage)
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 !

Akzeptierte Antwort

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

Weitere Antworten (0)

Kategorien

Mehr zu Elementary Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by