Documentation Home Page RT-LAB Home Page
Pour la documentation en FRANÇAIS, utilisez l'outil de traduction de votre navigateur Chrome, Edge ou Safari. Voir un exemple.



Model Interaction, MATLAB Variables


Set the values of one or more MATLAB variable type parameters by specifying each variable's ID and Value as a pair.

The API call only works when the <model_name>.param file has these MATLAB variables defined. MATLAB variables get added to the these variables if they are assigned inside the MATLAB command before opening model box of the Simulation Tool tab (in the model explorer window).

The MATLAB variables can also be added inside the model 


RtlabApi.SetVariables(((varID1, varVal1),(varID2, varVal2), ... ))


  • varID1: ID of a MATLAB variable

  • varVal1: Value of the related MATLAB Variable.

  • ((varID1, varVal1), ...): A Tuple of pair-like tuples with each pair consisting of variable ID & its related value, e.g. (varID1, varVal1) represents one such pair-type tuple.




  • EOK: Success.

  • EINVAL: One of the variables doesn’t exist.

  • ENOMEM: Memory allocation error.

  • EIO: Error sending the request or receiving the reply.

  • EBADF: Model not specified by previous Connect or OpenProject.

  • OP_API_MODEL_IO_TIMEOUT: Timed out waiting for reply from model.

  • OP_API_MODEL_IO_ERROR: Model is missing some or all processes or subsystems.

OPAL-RT TECHNOLOGIES, Inc. | 1751, rue Richardson, bureau 1060 | Montréal, Québec Canada H3K 1G6 | | +1 514-935-2323