Main Content

load_system

R2026b

Load Simulink model into memory

Description

handle = load_system(sys) loads the model sys into memory without opening the model in the Simulink® Editor. After you load a model into memory, you can work with the model using Simulink APIs. Save changes to the model using save_system.

Note

Security Considerations: Before you load the model using load_system, make sure you trust the sender or the author of the model. Models from unknown sources might contain unsafe content. Unknown sources include models you clone from a remote repository, download, or receive as an archive.

example

Examples

collapse all

Suppose you have a model named myModel. Load the model into memory and return the model handle.

h = load_system("myModel");

Check that the model is loaded using the bdIsLoaded function. If the model is loaded, the function returns 1. If the model is not loaded, the function returns 0.

bdIsLoaded("myModel")
ans =
  logical
   1

Input Arguments

collapse all

Systems to load, specified as one or more handles or model names. Format the handles as numeric scalars or numeric arrays. Format the names as strings, string arrays, character vectors, or cell arrays of character vectors. Do not specify file extensions in the names.

For information about getting handles, see Get Handles and Paths.

Example: "myModel"

Example: ["myModel1";"myModel2"]

Data Types: double | array of doubles | string | string array | character vector | cell array of character vectors

Output Arguments

collapse all

Handle of loaded model, specified as a numeric scalar or array.

Data Types: double | array of doubles

Version History

Introduced before R2006a