storing points using a threshold critera

조회 수: 1 (최근 30일)
shobhit mehrotra
shobhit mehrotra 2014년 8월 20일
댓글: Image Analyst 2014년 8월 20일
i have data of time vs concentration. i want to first find the point that crosses a threshold (concentration) of 15, then find the next point which goes below the threshold. then i want to store all of the points between the first point and second point into a vector in the workspace p(1), p(2) p(3) ... i want to create a loop such that it repeats finding the first and last points from time =0 to time = end. attached is a picture the points in yellow are the data that exceeds the threshold

답변 (1개)

Image Analyst
Image Analyst 2014년 8월 20일
편집: Image Analyst 2014년 8월 20일
OK. Seems easy enough. What did you try? Did you try
indexesAboveThreshold = find(signal > 15);
signalElementsAboveThreshold = signal(indexesAboveThreshold);
??? Do you actually have a question?
If you don't care about what the indexes are you can do it in a single line:
signalElementsAboveThreshold = signal(signal > 15);
Did you try that? What happened when you did?
  댓글 수: 2
shobhit mehrotra
shobhit mehrotra 2014년 8월 20일
my question is how do i create a program that would take the first point above the threshold then find the next point that dips below the threshold. then take all of the points in between and store it as a vector
Image Analyst
Image Analyst 2014년 8월 20일
OK - you need to know how to create programs. There's a faq answer for that: http://www.mathworks.com/matlabcentral/answers/8026-best-way-s-to-master-matlab
By the way, it seems I already did the program for you, vectorized, with a for loop. Good luck in learning MATLAB! If you write an alternate program and need help, come back here.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by