Easy? How can I remove data below or above a certain value?

조회 수: 28 (최근 30일)
Patrick
Patrick 2013년 12월 4일
댓글: Image Analyst 2020년 11월 17일
I have a long vector, with values between 0 and 10,000. I'd like to separate this into three new vectors: one containing only the values between 0 and 1,000; one containing only the values between 1,000 and 5,000; and one containing the values above 5,000. How can I do this?

채택된 답변

Image Analyst
Image Analyst 2013년 12월 4일
First of all, it's not long - far, far from it. To find values in a range, you need to create a logical vector that says whether an element is, or is not, in the range. Like this:
vector = 9000*rand(1, 100); % Sample data
% Extract elements in the first range.
inRange = vector < 1000;
firstRange = vector(inRange);
% Extract elements in the second range.
inRange = vector > 1000 & vector <= 5000;
secondRange = vector(inRange);
% Extract elements in the third range.
inRange = vector > 5000;
thirdRange = vector(inRange);
  댓글 수: 2
Sudhir Rai
Sudhir Rai 2020년 11월 17일
I have data for time(t) and pressure (p).
I want to fit these data to equation
I have done simple calcualtion and fittings in matlab. plese suggest how to fit data.
Please help.
Image Analyst
Image Analyst 2020년 11월 17일
See attached demo and make adaptations. Start a new question since your question here has nothing to do with this thread at all.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by