MATLAB: How to delete certain rows of a table based on time

datadeleting rows

I have minute by minute data for gold prices, and need to delete rows that are not in the time range 8:25-9:00. The data goes throughout the entire day, before going to the next day (so the rows deleted are not all together). Any idea on how to do this? I have attached a picture of my data table.

Best Answer

h = hour(yourtable.DateTime);
m = minute(yourtable.DateTime);
filteredtable = yourtable((h == 8 & m >= 25) | (h == 9 & m ==0), :)