Main Content

extmodeInit

Initialize external mode target connectivity

Description

example

errorCode = extmodeInit(extmodeInfo, finalTime); initializes the external mode target connectivity, including the underlying communication stack.

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

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

Model structure that contains information for the external mode simulation. RTWExtModeInfo is defined in matlabroot/simulink/include/rtw_extmode.h.

If the model’s final simulation time in the external mode abstraction layer is initialized, then finalTime is an output and the pointer location is updated with the initialized value. You might initialize the final simulation time through the '-tf ' option detected by extmodeParseArgs() or extmodeSetFinalSimulationTime()

If the model’s final simulation time in the external mode abstraction layer is not initialized, then finalTime is an input and the model’s final simulation time in external mode is updated accordingly.

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.

  • EXTMODE_ERROR (-12) –– External mode generic error detected.

Introduced in R2018a