Values substitution of intervals.

7 vues (au cours des 30 derniers jours)
Michal Schreiner
Michal Schreiner le 3 Juin 2020
Hello,
Its any easy way how to substitue interval in array with one value?
For example:
Values from 1400 to 1500 substitute with value 0.
Values from 1650 to 1750 substitute with 30.
Values from 1950 to 2000 substitue with 60.
I know about x(x<trehshold)=0 , but i need to use interval.
Thanks for reply!

Réponse acceptée

madhan ravi
madhan ravi le 3 Juin 2020
Modifié(e) : madhan ravi le 3 Juin 2020
interval1 = (x >= 1400) & (x <= 1500);
interval2 = (x >= 1650) & (x <= 1750);
interval3 = (x >= 1950) & (x <= 2000);
x(interval1) = 0;
x(interval2) = 30;
x(interval3) = 60
  1 commentaire
Michal Schreiner
Michal Schreiner le 3 Juin 2020
Thanks for your help !

Connectez-vous pour commenter.

Plus de réponses (1)

David Hill
David Hill le 3 Juin 2020
x(x>=1400&x<=1500)=0;
  1 commentaire
Michal Schreiner
Michal Schreiner le 3 Juin 2020
Thank you so much

Connectez-vous pour commenter.

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by