MATLAB Answers

Howe can I subtract neighboring numbers?

조회 수: 1(최근 30일)
Max Behr
Max Behr 7 Jul 2019
댓글: Max Behr 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

댓글을 달려면 로그인하십시오.

채택된 답변

Andrei Bobrov
Andrei Bobrov 7 Jul 2019
diff(z)
z/60

  댓글 수: 5

표시 이전 댓글 수: 2
Max Behr
Max Behr 7 Jul 2019
How can I change the collums and the lines?
SO the result is still from "left to right "instead of "up to down"?
Andrei Bobrov
Andrei Bobrov 7 Jul 2019
diff([0,z(:)'])
or
diff([0;z])
Max Behr
Max Behr 7 Jul 2019
Thanks works fine!

댓글을 달려면 로그인하십시오.

추가 답변(0개)

범주

제품


릴리스

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by