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!