Main Content

extmodeParseArgs

Extract values of configuration parameters supported by external mode abstraction layer

Description

example

errorCode= extmodeParseArgs (argCount,argValues);提取配置参数的值s 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 tortIOStreamOpenfor 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 macroEXTMODE_DISABLE_ARGS_PROCESSING. See information about parsing command-line arguments inOther 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, seeExternal Mode Abstraction Layer.

Input Arguments

collapse all

Number of elements inargValuesarray.

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

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

  • '-tffinalSimulationTime'finalSimulationTimeoverrides the Simulink configuration parameter,StopTime.

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

Output Arguments

collapse all

Error code, returned as anextmodeErrorCode_Tenumeration with one of these values:

  • EXTMODE_SUCCESS(0) –– No error detected.

  • EXTMODE_INV_ARG(-1) –– Arguments invalid.

Introduced in R2018a