Howe can I subtract neighboring numbers?

1 visualizzazione (ultimi 30 giorni)
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

Risposta accettata

Andrei Bobrov
Andrei Bobrov il 7 Lug 2019
diff(z)
z/60
  5 Commenti
Andrei Bobrov
Andrei Bobrov il 7 Lug 2019
Modificato: Andrei Bobrov il 7 Lug 2019
diff([0,z(:)'])
or
diff([0;z])
Max Behr
Max Behr il 7 Lug 2019
Thanks works fine!

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange

Prodotti


Release

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by