Main Content

extmodeParseArgs

Extract values of configuration parameters supported by external mode abstraction layer

Description

example

errorCode = extmodeParseArgs(argCount, argValues); extracts the values of the configuration parameters that are supported by the external mode abstraction layer. The function parses the array of strings passed as input arguments. The array of strings is from the command-line arguments of the executable file running on the target hardware.

The external mode abstraction layer interprets only two options and passes the other arguments to rtIOStreamOpen for the initialization of the communication driver.

Use this function with other external mode functions to enable communication between Simulink® and the target application during an external mode simulation.

If your target hardware does not support the parsing of command-line arguments, define the preprocessor macro EXTMODE_DISABLE_ARGS_PROCESSING. See information about parsing command-line arguments in Other Platform Abstraction Layer Functionality.

Examples

Set Up External Mode Communication

For a pseudo-code example that shows how you can provide external mode communication by using the function with related functions, see External Mode Abstraction Layer.

Input Arguments

collapse all

Number of elements in argValues array.

Command-line arguments of the executable file running on the target hardware. The external mode abstraction layer interprets only these options:

  • '-w' – Enables the extmodeWaitForStartRequest() function, which waits for a model start request from Simulink in external mode. If you do not specify this option, the extmodeWaitForStartRequest() function has no effect.

  • '-tf finalSimulationTime'finalSimulationTime overrides the Simulink configuration parameter, StopTime.

If the command contains more options, they are passed to rtIOStreamOpen as configuration parameters for the communication driver.

Output Arguments

collapse all

Error code, returned as an extmodeErrorCode_T enumeration with one of these values:

  • EXTMODE_SUCCESS (0) –– No error detected.

  • EXTMODE_INV_ARG (-1) –– Arguments invalid.

Introduced in R2018a