How to create an interval for an if statement?
5 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
How can I say if q equals to 5 or 10 or 15 or ..... then
if q == 5:5:200 does not work.
0 件のコメント
採用された回答
Cris LaPierre
2021 年 3 月 11 日
Try ismember
if ismember(q,5:5:200)
2 件のコメント
Cris LaPierre
2021 年 3 月 12 日
I wouldn't use this approach for that. There are other functions I would point out to you.
- yearYear number
- quarterQuarter number
- monthMonth number and name
- weekWeek number
- dayDay number or name
- hourHour number
- minuteMinute number
- secondSecond number
Combine these with >= and <= to find the indices that meet your criteria.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Loops and Conditional Statements についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!