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

6 vues (au cours des 30 derniers jours)
PIRIL
PIRIL le 21 Fév 2014
Commenté : PIRIL le 21 Fév 2014
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 !

Réponse acceptée

Andrei Bobrov
Andrei Bobrov le 21 Fév 2014
A=[3.5,4.5;2.4,3.2];
out = bsxfun(@minus,A,A(:,1));

Plus de réponses (0)

Catégories

En savoir plus sur Language Fundamentals dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by