Consecutive subtraction of the entries of a vector
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hmm!
el 13 de En. de 2021
Comentada: James Tursa
el 14 de En. de 2021
I am a novist in MATLAB. I have no idea of how to subtract the entries of a vector consecutively. Say if A=[3,5,9,11,15]' and I want something like this B =[3, 2, 4, 2, 4]. Any help will do, thanks in advance.
0 comentarios
Respuesta aceptada
James Tursa
el 13 de En. de 2021
Editada: James Tursa
el 13 de En. de 2021
If A is a row vector:
B = [A(1) diff(A)];
If A is a column vector:
B = [A(1);diff(A)];
3 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!