Reputation: 555
Lately MATLAB's built-in datenum() function crashes whenever I specify a formatIn - even if I use the examples from the documentation.
For example:
datenum('01-Mar-2000', 'formatIn', 'dd-mmm-yyyy')
will give me the following error:
DATENUM failed.
Caused by:
Error using matlab.internal.datetime.cnv2icudf (line 143)
Unrecognized millisecond format. Format: formatIn.
I've tried it with many other date formats, and I always get this error when I specify a formatIn.
The only time I do not get this error, is when I leave out the formatIn.
However, leaving out formatIn and forcing datenum() to recognize the date format on its own, slows down my code considerably.
Any idea what might be wrong?
Upvotes: 0
Views: 108
Reputation: 555
As user @user12339314 pointed out in his comment, my mistake was that I was trying to call the function with formatIn as a name-value argument - which it isn't.
So instead of
datenum('01-Mar-2000', 'formatIn', 'dd-mmm-yyyy')
it should be
datenum('01-Mar-2000', 'dd-mmm-yyyy')
Upvotes: 1