datenum(ye​ar,month,d​ay,hr) that returns integer

조회 수: 2(최근 30일)
Chris Hooper
Chris Hooper 2022년 5월 13일
댓글: Chris Hooper 2022년 5월 14일

I need a datenum(year,month,day,hr) that returns an integer, where year, month, day, and hr are vectors of integers.
motivation: I am trying to do this for fast lookup of many dates in a large table, where each row contains data for an hourly sample. Therefor the output of datnum will become the indices of a sparse matrix containing the row indices of the original table of data.

채택된 답변

dpb 2022년 5월 13일
Wrong approach.
Instead, convert the table to a timetable; there are direct, builtin functions to return by rowtimes either individual records or those matching a time span, etc., ...
  댓글 수: 2
Chris Hooper
Chris Hooper 2022년 5월 14일
awesome thanks!

댓글을 달려면 로그인하십시오.

추가 답변(0개)


Community Treasure Hunt

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

Start Hunting!

Translated by