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

3 visualizaciones (últimos 30 días)
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 !

Respuesta aceptada

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

Más respuestas (0)

Categorías

Más información sobre Elementary Math en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by