How to create an interval for an if statement?

26 views (last 30 days)
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.

Accepted Answer

Cris LaPierre
Cris LaPierre on 11 Mar 2021
if ismember(q,5:5:200)
  2 Comments
Cris LaPierre
Cris LaPierre on 12 Mar 2021
I wouldn't use this approach for that. There are other functions I would point out to you.
Extract Components by Time Unit (from this page)
Combine these with >= and <= to find the indices that meet your criteria.
Perhaps some of the ideas presented in this answer will help.

Sign in to comment.

More Answers (0)

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!