Is there a function similar to "where"?

For example i am going through a table of data with dates ranging from early 2016 through 2022, every day.
If i only want to extract data from say 2016, is there a way i can say for example:
where date is >= 01/01/2016 & < 01/01/2017
Is there any way of doing this?
Thanks

 Accepted Answer

Walter Roberson
Walter Roberson on 10 Feb 2023
Edited: Walter Roberson on 11 Feb 2023

3 Comments

I think you meant timerange instead of daterange.
Oh, yes, you are right!
This is exactly what i was looking for, thank you very much

Sign in to comment.

More Answers (1)

Yes it is called logical indexing.
The exact details depend on what type of data you have. A plain numeric matrix, a table, a cell array?

2 Comments

This was also very helpful to look at, thank you.
You are quite welcome.

Sign in to comment.

Products

Asked:

Tom
on 10 Feb 2023

Commented:

on 13 Feb 2023

Community Treasure Hunt

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

Start Hunting!