MATLAB Answers

0

Howe can I subtract neighboring numbers?

Asked by Max Behr on 7 Jul 2019
Latest activity Commented on by Max Behr on 7 Jul 2019
Hello,
I got a matrix like this:
>> z=[1,2,3,4]
z =
1 2 3 4
How can I substract the neighboring numbers?
Like 2-1; 3-2; 4-3; etc.
And how can I divide every number by 60 ?
Like 1/60 2/60 etc

  0 Comments

Sign in to comment.

Products


Release

R2019a

1 Answer

Answer by Andrei Bobrov
on 7 Jul 2019
 Accepted Answer

diff(z)
z/60

  5 Comments

How can I change the collums and the lines?
SO the result is still from "left to right "instead of "up to down"?
diff([0,z(:)'])
or
diff([0;z])
Thanks works fine!

Sign in to comment.