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

3 visualizzazioni (ultimi 30 giorni)
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 !

Risposta accettata

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

Più risposte (0)

Categorie

Scopri di più su Language Fundamentals in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by