Constant variable

To my last question, it does not need to increase by exactly 20, just 20 or more. Could I write: col3select=[0; doff(info(:,3))] >20;

답변 (1개)

Geoff
Geoff 2012년 3월 20일

0 개 추천

Well, you want greater-or-equal. So replace the == with >=
Also, if you want to clarify an answer to a question, please write a comment on the particular answer instead of starting a new question.
Edit, following new revelations =P
Okay, you used confusing language and did not explain your problem clearly.
There may be clever ways to do this is, but I think you would benefit most from a simple and self-explanatory loop:
overThreshold = false;
col3select = false(size(info,1), 1);
for r = 1:size(info,1)
if info(r,3) >= 520
overThreshold = true;
elseif info(r,3) <= 500
overThreshold = false;
end
col3Select(r) = overThreshold;
end

댓글 수: 5

justin
justin 2012년 3월 21일
ok that worked but how could I change the command so that when it increases by 20 is shows not only that point but all the way until it goes back to its baseline. say the baseline is 500, I want to know the locations where it increases from 500 to 520 or higher and records those positions until it is back down at 500. And to do this for everytime this occurs?
Jan
Jan 2012년 3월 21일
Baseline?? It increases by 20??
If you are talking about a program, which is posted in another thread, please post the link.
justin
justin 2012년 3월 21일
Ok, I have a matrix info(10000x3) where (:,1)=time, (:,2)=data2, and (:,3)=data3. For (:,3) data3 the average (baseline) value is 500. I want to find the location in(:,3) data3 where the value increases by 20 or more ~ 520+ , and record that value and keep recording until it returns back to the baseline of 500. I would like todo this each time the value exceeds 500 by 20 or more. Thanks
Geoff
Geoff 2012년 3월 22일
@Jan: Unfortunately, justin deleted the original question that I answered, because he wanted to ask a question about my answer. But I'm in a good mood today.
Geoff
Geoff 2012년 3월 22일
Oh, my bad, that was someone else... He just asked a new question instead. heheh

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

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

질문:

2012년 3월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by