How to create an interval for an if statement?
조회 수: 4 (최근 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!