Borrar filtros
Borrar filtros

Difference between two iteration of for loop

3 visualizaciones (últimos 30 días)
Nasser Hasani
Nasser Hasani el 12 de Jun. de 2018
Comentada: Nasser Hasani el 12 de Jun. de 2018
Hi I need to have difference between to successive iteration of for loop. As example:
For i=1:n P(i)=statement; end
How can I calculate: DeltaP=P(i)-P(i-1)??!! THANKS

Respuesta aceptada

Adam
Adam el 12 de Jun. de 2018
diff( P )
after the for loop should do this for you for all pairs of consecutive elements of P

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by