How to do a subtraction of each element in a row with the first element of each row using a loop function MATLAB?

1

This is my matrix:

a=
2.88018141156171    4.49406146768661    4.39969572964863    5.77382684781782    
0.302326568062510   0.913580405174539   1.38826913246346    2.16529080203233    

And this is my 'first number' vector:

first number =
2.88018141156171
0.302326568062510

I would like to subtract each element in the row with the first number in that specific row.
How can I write a loop function?

user993075

Posted 2019-02-01T21:25:04.380

Reputation: 11

"subtract with" is not valid syntax. And given that subtraction is noncommutative, precise language is important. Do you want to subtract each element from the first, or the first from each element? – Acccumulation – 2019-02-01T22:46:24.263

What have you tried? SuperUser is not a script-writing service. Please try writing such a function yourself and once you've come to a problem you cannot solve, we may be able to assist then. – music2myear – 2019-02-01T23:54:54.577

No answers