Borrar filtros
Borrar filtros

Howe can I subtract neighboring numbers?

1 visualización (últimos 30 días)
Max Behr
Max Behr el 7 de Jul. de 2019
Comentada: Max Behr el 7 de Jul. de 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

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 7 de Jul. de 2019
  5 comentarios
Andrei Bobrov
Andrei Bobrov el 7 de Jul. de 2019
Editada: Andrei Bobrov el 7 de Jul. de 2019
diff([0,z(:)'])
or
diff([0;z])
Max Behr
Max Behr el 7 de Jul. de 2019
Thanks works fine!

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by