greater than and less than

97 ビュー (過去 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 Center および File ExchangeDescriptive Statistics and Visualization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by