Products & Services Solutions Academia Support User Community Company

Learn more about MATLAB   

Calculating Dates in Programs

To ensure the correct calculation of functions using date values, replace datenum function calls with the use of the dir function datenum field.

For example, look at the modification date of your MATLAB license.txt file:

cd(matlabroot)
f=dir('license.txt')

MATLAB displays information similar to:

f = 
       name: 'license.txt'
       date: '10-May-2007 17:48:22'
      bytes: 5124
      isdir: 0
    datenum: 7.3317e+005

If your code uses a command similar to:

n=datenum(f.date);

you must replace it with:

n=f.datenum;
  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS