| Contents | Index |
DateNum = m2xdate(MATLABDateNumber, Convention)
MATLABDateNumber | A vector or scalar of MATLAB serial date numbers. |
Convention | (Optional) Excel date system. A vector or scalar. When Convention = 0 (default), the Excel 1900 date system is in effect. When Convention = 1, the Excel 1904 date system in used. In the Excel 1900 date system, the Excel serial date number 1 corresponds to January 1, 1900 A.D. In the Excel 1904 date system, date number 0 is January 1, 1904 A.D. Due to a software limitation in Excel software, the year 1900 is considered a leap year. As a result, all DATEVALUE's reported by Excel software between Jan. 1, 1900 and Feb. 28, 1900 (inclusive) differs from the values reported by 1. For example:
|
Vector arguments must have consistent dimensions.
DateNum = m2xdate(MATLABDateNumber, Convention) converts MATLAB serial date numbers to Excel serial date numbers. MATLAB date numbers start with 1 = January 1, 0000 A.D., hence there is a difference of 693960 relative to the 1900 date system, or 695422 relative to the 1904 date system. This function is useful with Spreadsheet Link™ EX software.
Given MATLAB date numbers for Christmas 2001 through 2004
DateNum = datenum(2001:2004, 12, 25)
DateNum =
731210 731575 731940 732306
convert them to Excel date numbers in the 1904 system
ExDate = m2xdate(DateNum, 1)
ExDate =
35788 36153 36518 36884
or the 1900 system
ExDate = m2xdate(DateNum)
ExDate =
37250 37615 37980 38346
View demos and recorded presentations led by industry experts.
Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |