In MATLAB 7.5 (R2007b), date strings are derived from the locale settings set by the user on the system. The Locale Settings are available from:
Start -> Settings -> Control Panel -> Regional and Language Settings
DATENUM uses a locale database that may or may not be the same as the locale settings on your system. Therefore, DATENUM is sometimes unable to recognize date strings originating from locale settings.
To work around this issue, use the "datenum" field on the structure variable returned by the DIR command. For example:
will produce the corresponding serial date numbers of the file time stamps in MATLAB.
Historical information about the behavior of MATLAB R14SP3 through R2008b:
1. The MATLAB releases R14SP3, R2006a and R2006b do not include a "datenum" field in the structure returned by the function DIR. The field "date" returns the date in English format.
2. The MATLAB release R2007a includes a "datenum" field in the structure returned by the function DIR for the first time. The field "date" still returns the date in English format.
3. Starting with MATLAB release R2007b, the "datenum" field is included in the structure returned by the function DIR, but the field "date" returns the date by using the format specified in the system locale settings.
Here's an example for a machine that uses German system locale settings:
- R14SP3, R2006a, R2006b
------------------------------
>> d = dir
d =
4x1 struct array with fields:
name
date
bytes
isdir
>> d.date
ans =
07-Oct-2008 10:17:11
------------------------------
- R2007a
------------------------------
>> d = dir
d =
4x1 struct array with fields:
name
date
bytes
isdir
datenum
>> d.date
ans =
07-Oct-2008 10:32:00
------------------------------
- R2007b, R2008a, R2008b
------------------------------
>> d = dir
d =
4x1 struct array with fields:
name
date
bytes
isdir
datenum
>> d.date
ans =
07-Okt-2008 10:32:00
------------------------------
Best Answer