Howe can I subtract neighboring numbers?

1 回表示 (過去 30 日間)
Max Behr
Max Behr 2019 年 7 月 7 日
コメント済み: Max Behr 2019 年 7 月 7 日
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

採用された回答

Andrei Bobrov
Andrei Bobrov 2019 年 7 月 7 日
  5 件のコメント
Andrei Bobrov
Andrei Bobrov 2019 年 7 月 7 日
編集済み: Andrei Bobrov 2019 年 7 月 7 日
diff([0,z(:)'])
or
diff([0;z])
Max Behr
Max Behr 2019 年 7 月 7 日
Thanks works fine!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by