Main Content

Define Datetime Array Inputs

You can define datetime array inputs at the command line or in the MATLAB® Coder™ app. 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);
codegen myFunction -args {D}

Provide a Datetime Array Type

To provide a type for a datetime array to codegen:

  1. Define a datetime array. For example:

    D = datetime(2019,1:12,1,12,0,0);
    

  2. Create a type from D.

    t = coder.typeof(D);
    

  3. Pass the type to codegen by using the -args option.

    codegen 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);
codegen myFunction -args {coder.Constant(C)}

Define Datetime Array Inputs in the MATLAB Coder App

Use one of these procedures:

See Also

| | |

Related Topics