Reputation: 1986
Trying to help my daughter with matlab 2014 basic. (I have never used it). In the command window I tried to use the month() functions in various ways that I read in the documentation but matlab returns "month not found" I tried various datetime functions that appear to be in matlab core and they all failed. Is there a project library that needs to be added? Do these functions work in the command line?
Upvotes: 1
Views: 3057
Reputation: 23908
If you're using Matlab R2014b, there is a new datetime
datatype in the core Matlab language. It supports access to calendar fields like month, year, and day, and is supposedly the main date representation in Matlab going forward. You can use this without having to install the Financial Toolbox.
http://www.mathworks.com/help/matlab/date-and-time-operations.html
Note that now()
and today()
still return datenums; you need to do datetime('now')
or datetime('today')
to get equivalent datetime
values.
All normal Matlab functions and classes can be used from the command line, and anything run on the command line can be called in a script or function. It's the exact same language for both.
Upvotes: 3
Reputation: 13945
Ok so to follow up on my comment:
1) You need the Financial Toolbox to have access to the 'month' function. In order to know what is installed on your computer, type ver
in the Command Window.
2) MATLAB has some builtin functions to play around with dates and times. For example, date returns a string containing the current dat in the day-month-year format and calendar returns an array of double from which you can extract specific dates.
Upvotes: 2