MATLAB: EXTRACTING NETCDF DATA BASED ON TIME

MATLABnetcdftimewile e. coyote

Good afternoon:
I am operating on a NetCDF file that contains data for 20 variables over a period of 8 months. This is too much data, so I am trying to extract data based on the time of day. That is, to extract data for all variables from 11pm to 4am for each day in the data file. I have been able to pull out the date / time in the format "dd-mmm-yyyy hh:mm:ss". I can extract and work on ranges of time, but not a range of time per day, for many days.
I can see in my head how to do this, but I am unsure of an efficient way to code it. Experimenting with different time functions, (datenum,hours, datetime, datevec) with other structure and NetCDF tools have been unsucessful. I could use a shove in the right direction. Thank you.

Best Answer

See https://www.mathworks.com/matlabcentral/answers/312198-how-to-extract-data-from-nc-file-based-on-latitude-longitude-time-and-wind#comment_464820 and note that in my sample "expanding the selection" code that you could code hours and minutes into the from date and to date strings.