MATLAB: Do I receive an error when using the structure from the DIR command in MATLAB 7.4 (R2007a)

2006achangedirMATLAB

I am using a certain code that involves comparing the structure that I got from the DIR command with another structure. This code was working fine in MATLAB 7.3 (R2006b) but is giving me an error in MATLAB 7.4 (R2007a). The error I get is:
??? Subscripted assignment between dissimilar structures.

Best Answer

The output structure from the DIR command was changed between MATLAB 7.3 (R2006b) and MATLAB 7.4 (R2007a). In R2007a, a new field called 'datenum' was added to this structure. This is the reason you are getting the error.
Hence, in R2006b, typing the following in the MATLAB command prompt would give:
a = dir
a =
5x1 struct array with fields:
name
date
bytes
isdir
where as in R2007a, it gives:
a = dir
a =
5x1 struct array with fields:
name
date
bytes
isdir
datenum