Hello, could you please help me on the following issue. I imported an Excel file containing the vector of dates (44 by 1, type – cell):
[temp, holidays]=xlsread('Holidays.xlsx', 'Tabelle1', 'A1:A44').
Then, I created the date vector with a step of 1 minute:
start_date = datenum('18-Apr-2015 16:30:00');end_date = datenum('19-Apr-2015 10:00:00');interval = 10/24/60;date = datestr(start_date:interval:end_date);
My goal is to create a logical array that puts 1 if the date from the second (longer) vector equals the date in the first vector and 0 otherwise.
I tried the code below, but I have problems with data formats, which I cannot solve. Error using datenum (line 179) DATENUM failed.
Caused by: Error using dtstr2dtnummx Failed on converting date string to date number.
criteria=[];for i=1:length(date) if day(holidays(i))==day(date(i)) && month(holidays(i))==month(date(i)) && year(holidays(i))==year(date(i)) criteria(i)=1 else criteria(i)=0 endend
Can please anyone help on that? Thanks a lot in advance!
Best Answer