Values substitution of intervals.

조회 수: 5 (최근 30일)
Michal Schreiner
Michal Schreiner 2020년 6월 3일
댓글: Michal Schreiner 2020년 6월 3일
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!

채택된 답변

madhan ravi
madhan ravi 2020년 6월 3일
편집: madhan ravi 2020년 6월 3일
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개)

David Hill
David Hill 2020년 6월 3일
x(x>=1400&x<=1500)=0;

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by