Define Datetime Array Inputs
You can define datetime
array inputs at the
command line. Programmatic specification of datetime
input types by using
preconditioning (assert
statements) is not supported.
Define Datetime Array Inputs at the Command Line
Use one of these procedures:
Alternatively, if you have a test file that calls your entry-point function with example
inputs, you can determine the input types by using
coder.getArgTypes
.
Provide an Example Datetime Array Input
Use the -args
option:
D = datetime(2019,1:12,1,12,0,0); fiaccel myFunction -args {D}
Provide a Datetime Array Type
To provide a type for a datetime
array to fiaccel
:
Define a
datetime
array. For example:D = datetime(2019,1:12,1,12,0,0);
Create a type from
D
.t = coder.typeof(D);
Pass the type to
fiaccel
by using the-args
option.fiaccel myFunction -args {t}
Provide a Constant Datetime Array Input
To specify that a datetime
array input is constant, use
coder.Constant
with the -args
option:
D = datetime(2019,1:12,1,12,0,0); fiaccel myFunction -args {coder.Constant(C)}
Representation of Datetime Arrays
A coder type object for a datetime array describes the object and its properties. Use
coder.typeof
(MATLAB Coder) or pass datetime
as a string scalar to
coder.newtype
(MATLAB Coder).
The coder type object displays a succinct description of the object properties while excluding internal state values. Nonconstant properties display their type and size, while constant properties display only their values. For example:
t = datetime(2019,1:12,1,12,0,0); tType = coder.typeof(t)
The representation of variable t
is stored in coder type object
tType
.
tType = matlab.coder.type.DatetimeType 1x12 datetime Format : 1x0 char TimeZone : 1x0 char
If your workflow requires the legacy representation of coder type objects, use the
getCoderType
function on the variable that has the new representation
of your class or object. See Legacy Representation of Coder Type Objects (MATLAB Coder).
Resize Object Properties by Using coder.resize
You can resize most objects by using coder.resize
(MATLAB Coder). You can resize objects, its properties and create arrays
within the properties.
For a datetime
coder object, you can resize the object
properties:
t = datetime(2019,1:12,1,12,0,0); tType = coder.typeof(t) tType.Format = coder.resize(tType.Format, [1 12])
This code resizes the Format
property to be a
1x12
char
property.
tType = matlab.coder.type.DatetimeType 1x12 datetime Format : 1x12 char TimeZone : 1x0 char
You can also resize the object by using coder.resize
. See Edit and Represent Coder Type Objects and Properties (MATLAB Coder).
See Also
datetime
| NaT
| coder.Constant
(MATLAB Coder) | coder.typeof
(MATLAB Coder)