How can I subtract the two columns of the same matrix?

30 views (last 30 days)
How can I subtract the two columns of the same matrix?

Accepted Answer

Walter Roberson
Walter Roberson on 7 Oct 2015
diff(YourMatrix,2)
or
YourMatrix(:,2) - YourMatrix(:,1)
  2 Comments
Efe IST
Efe IST on 7 Oct 2015
Edited: Efe IST on 7 Oct 2015
Thank you for the quick answer. How can I add the result as a 4th column into the same matrix on which I performed the subtraction?-Just found out how! Thanks for the reply again.

Sign in to comment.

More Answers (0)

Categories

Find more on Word games in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!