Change sign of descending values

1 visualizzazione (ultimi 30 giorni)
Morten Nielsen
Morten Nielsen il 27 Giu 2019
Risposto: James Tursa il 27 Giu 2019
How can i change the sign of decending values ?
4165
4230
4296
4361
4430
4476
4549
4604
4664
4705
4710
4714
4718
4718
4716
4713
4708
4697
4646
4572
4491
  1 Commento
James Tursa
James Tursa il 27 Giu 2019
What is the exact desired output for your example?

Accedi per commentare.

Risposta accettata

James Tursa
James Tursa il 27 Giu 2019
Is this what you want?
x = your vector of values
d = [1;diff(x)];
x(d<0) = -x(d<0);

Più risposte (0)

Categorie

Scopri di più su File Operations in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by