greater than and less than

조회 수: 62 (최근 30일)
Patrick
Patrick 2011년 2월 17일
답변: LINDANI ZUNGU 2020년 12월 13일
I cant find format for a command that finds all values between 2 different parameters, it is something like this:
data = sscanf (tempstng, '%d');
If data(4) > 13 & < 15;
Do sequence;
If data(4) > 2 & < 4;
Do Something else;
else sscanf (tempstng, '%d');
end;
Any ideas? Patrick

채택된 답변

the cyclist
the cyclist 2011년 2월 17일
if data(4) > 13 & data(4) < 15
blah blah
elseif data(4) > 2 & data(4) < 4
other blah blah
else
that other thing
end
  댓글 수: 1
Patrick
Patrick 2011년 2월 17일
Thanks, Didnt realise I had to state it twice

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

추가 답변 (2개)

Paulo Silva
Paulo Silva 2011년 2월 17일
data = sscanf (tempstng, '%d');
if ((data(4) > 13) & (data(4)< 15))
disp('if')
elseif ((data(4) > 2) & (data(4)< 4))
disp('elseif')
else
disp('else')
sscanf (tempstng, '%d');
end
  댓글 수: 1
Patrick
Patrick 2011년 2월 17일
Thanks, this works well!

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


LINDANI ZUNGU
LINDANI ZUNGU 2020년 12월 13일
how can i write age between 9-12 if age is between the two values ?

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by