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

3 次查看(过去 30 天)
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 !

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Elementary Math 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by