Documentation

Functions

Modeling

Modeling Basics

simulink Open Simulink block library
new_system Create empty Simulink system
open_system Open Simulink model, library, subsystem, or block dialog box
load_system Invisibly load Simulink model
add_block Add block to model
add_line Add line to Simulink system
replace_block Replace blocks in Simulink model
delete_block Delete block from Simulink system
delete_line Delete line from Simulink system
bdroot Return name of top-level Simulink system
find_system Find systems, blocks, lines, ports, and annotations
gcs Get pathname of current system
getfullname Get pathname of block or line
gcb Get pathname of current block
gcbh Get handle of current block
getSimulinkBlockHandle Get block handle from block path
set_param Set system and block parameter values
get_param Get parameter names and values
add_param Add parameter to Simulink system
delete_param Delete system parameter added via add_param command
Simulink.BlockDiagram.createSubSystem Create subsystem containing specified set of blocks
Simulink.BlockDiagram.deleteContents Delete contents of block diagram
Simulink.SubSystem.copyContentsToBlockDiagram Copy contents of subsystem to empty block diagram
Simulink.SubSystem.deleteContents Delete contents of subsystem
save_system Save Simulink system
close_system Close Simulink system window or block dialog box
bdclose Close any or all Simulink system windows unconditionally
bdIsLoaded Whether block diagram is in memory
bdIsLibrary Whether block diagram is a library
slCharacterEncoding Change MATLAB character set encoding
slIsFileChangedOnDisk Determine whether model has changed since it was loaded

Design Models

Model Hierarchy

Simulink.BlockDiagram.createSubSystem Create subsystem containing specified set of blocks
Simulink.BlockDiagram.copyContentsToSubSystem Copy contents of block diagram to empty subsystem
Simulink.SubSystem.convertToModelReference Convert subsystem to model reference
Simulink.SubSystem.copyContentsToBlockDiagram Copy contents of subsystem to empty block diagram
Simulink.SubSystem.deleteContents Delete contents of subsystem
Simulink.SubSystem.getChecksum Return checksum of nonvirtual subsystem

Multicore Processor Targets

Simulink.architecture.config Create or convert configuration for concurrent execution
Simulink.architecture.add Add tasks or triggers to selected architecture of model
Simulink.architecture.delete Delete triggers and tasks from selected architecture of model
Simulink.architecture.find_system Find objects under architecture object
Simulink.architecture.get_param Get configuration parameters of architecture objects
Simulink.architecture.importAndSelect Import and select target architecture for concurrent execution environment for model
Simulink.architecture.profile Generate profile report for model configured for concurrent execution
Simulink.architecture.register Add custom target architecture to concurrent execution target architecture selector
Simulink.architecture.set_param Set architecture object properties
Simulink.GlobalDataTransfer Configure concurrent execution data transfers

Configure Models

Blocks

set_param Set system and block parameter values
get_param Get parameter names and values
add_param Add parameter to Simulink system
delete_param Delete system parameter added via add_param command
eventData Provide information about block method execution events
Simulink.DualScaledParameter Specify value, value range, data type, and other properties of block parameter Specify name, value, units, and other properties of Simulink dual-scaled parameter
Simulink.Parameter Specify value, value range, data type, and other properties of block parameter Specify name, value, units, and other properties of Simulink dual-scaled parameter
Simulink.CoderInfo Specify information needed to generate code for signal or parameter

Signals

disableimplicitsignalresolution Convert model to use only explicit signal resolution
signalbuilder Create and access Signal Builder blocks
set_param Set system and block parameter values
get_param Get parameter names and values
Simulink.Signal Specify attributes of signal
Simulink.CoderInfo Specify information needed to generate code for signal or parameter

Variables

getVariable Get value of variable from workspace
hasVariable Determine if variable exists in workspace
Simulink.findVars Find variables in models and blocks
matlab.io.saveVariablesToScript Save workspace variables to MATLAB script
set_param Set system and block parameter values
get_param Get parameter names and values
Simulink.data.dictionary.create Create new data dictionary and create Simulink.data.Dictionary object
Simulink.data.dictionary.open Open data dictionary for editing
Simulink.data.evalinGlobal Evaluate MATLAB expression in context of Simulink model
Simulink.data.assigninGlobal Modify variable values in context of Simulink model
Simulink.data.existsInGlobal Check existence of variable in context of Simulink model
Simulink.data.dictionary.cleanupWorkerCache Restore defaults after parallel simulation with data dictionary
Simulink.data.dictionary.setupWorkerCache Enable parallel simulation with data dictionary
Simulink.ModelWorkspace Describe model workspace
Simulink.WorkspaceVar Contains information about workspace variables and blocks that use them
Simulink.VariableUsage Get information about workspace variables and blocks that use them
Simulink.data.Dictionary Configure data dictionary
Simulink.data.dictionary.Section Configure data dictionary section
Simulink.data.dictionary.Entry Configure data dictionary entry
Simulink.data.dictionary.EnumTypeDefinition Store enumerated type definition in data dictionary

Sample Time

Simulink.BlockDiagram.getSampleTimes Return all sample times associated with model
Simulink.Block.getSampleTimes Return sample time information for a block
Simulink.SampleTime Object containing sample time information
Simulink.BlockPortData Describe block input or output port

Data Types

enumeration Display class enumeration members and names
fixdt Create Simulink.NumericType object describing fixed-point or floating-point data type
fixpt_evenspace_cleanup Modify breakpoints of lookup table to have even spacing
fixpt_interp1 Implement 1-D lookup table
fixpt_look1_func_approx Optimize fixed-point approximation of nonlinear function by interpolating lookup table data points
fixpt_look1_func_plot Plot fixed-point approximation function for lookup table
fixpt_set_all Set property for each fixed-point block in subsystem
fixptbestexp Exponent that gives best precision for fixed-point representation of value
fixptbestprec Determine maximum precision available for fixed-point representation of value
float Create Simulink.NumericType object describing floating-point data type
fxptdlg Start Fixed-Point Tool
num2fixpt Convert number to nearest value representable by specified fixed-point data type
sfix Create Simulink.NumericType object describing signed fixed-point data type
sfrac Create Simulink.NumericType object describing signed fractional data type
Simulink.defineIntEnumType Define enumerated data type
Simulink.data.getEnumTypeInfo Get information about enumerated data type
sint Create Simulink.NumericType object describing signed integer data type
tunablevars2parameterobjects Create Simulink parameter objects from tunable parameters
ufix Create Simulink.NumericType object describing unsigned fixed-point data type
ufrac Create Simulink.NumericType object describing unsigned fractional data type
uint Create Simulink.NumericType object describing unsigned integer data type
Simulink.AliasType Create alias for signal and parameter data type
Simulink.NumericType Specify floating point, integer, or fixed point data type

Model, Block, and Port Callbacks

set_param Set system and block parameter values
get_param Get parameter names and values
getCallbackAnnotation Get information about annotation
Simulink.Annotation Specify properties of model annotation

Visual Presentation

Color

hilite_system Highlight Simulink object

Annotations

add_block Add block to model
docblock Get or set editor invoked by Simulink DocBlock
hilite_system Highlight Simulink object
getCallbackAnnotation Get information about annotation
Simulink.Annotation Specify properties of model annotation

Masking

Simulink.Mask Control masks programmatically
Simulink.MaskParameter Control mask parameters programmatically

Share Models

Print and Export Models

print Print figure or save to specific file format
orient Hardcopy paper orientation
frameedit Edit print frames for Simulink and Stateflow block diagrams

Transform Models

Discretization

slmdldiscui Open Model Discretizer GUI
sldiscmdl Discretize model that contains continuous blocks

Trimming and Linearization

trim Find trim point of dynamic system
dlinmod Extract discrete-time linear state-space model around operating point
linmod Extract continuous-time linear state-space model around operating point
linmod2 Extract continuous-time linear state-space model around operating point
linmodv5 Extract continuous-time linear state-space model around operating point
Simulink.BlockDiagram.getInitialState Return initial state structure of block diagram

Fixed Point

fxptdlg Start Fixed-Point Tool
fixdt Create Simulink.NumericType object describing fixed-point or floating-point data type
fixpt_evenspace_cleanup Modify breakpoints of lookup table to have even spacing
fixpt_interp1 Implement 1-D lookup table
fixpt_look1_func_approx Optimize fixed-point approximation of nonlinear function by interpolating lookup table data points
fixpt_look1_func_plot Plot fixed-point approximation function for lookup table
fixpt_set_all Set property for each fixed-point block in subsystem
fixptbestexp Exponent that gives best precision for fixed-point representation of value
fixptbestprec Determine maximum precision available for fixed-point representation of value
float Create Simulink.NumericType object describing floating-point data type
num2fixpt Convert number to nearest value representable by specified fixed-point data type
sfix Create Simulink.NumericType object describing signed fixed-point data type

Run Model Checks

modeladvisor Open Model Advisor
sldiagnostics Display diagnostic information about Simulink system
Simulink.BlockDiagram.getChecksum Return checksum of model
Simulink.SubSystem.getChecksum Return checksum of nonvirtual subsystem
addterms Add terminators to unconnected ports in model
Simulink.ModelAdvisor Run Model Advisor from MATLAB file
ModelAdvisor.Preferences Set Model Advisor preferences

Simulation

Configure Simulation

openDialog Open configuration parameters dialog
closeDialog Close configuration parameters dialog

Import Data

getInputString Create comma-separated list of variables to map
getSlRootInportMap Create custom object to map signals to root-level inports using Simulink mapping mode
getRootInportMap Create custom object to map signals to root-level inports
Simulink.BlockDiagram.getInitialState Return initial state structure of block diagram
Simulink.Bus.createMATLABStruct Create MATLAB structures using same hierarchy and attributes as bus signals
Simulink.SimulationData.createStructOfTimeseries Create a structure with MATLAB timeseries object leaf nodes

Run Simulation

Programmatic

sim Simulate dynamic system
model Execute particular phase of simulation of model
find Access and display values of simulation results
get Access and display values of simulation results
who List names of top-level data logging objects in Simulink data log
set_param Set system and block parameter values
get_param Get parameter names and values
getInitialState Return initial state structure of block diagram
setBlockSimState Set SimState of individual Stateflow Chart, MATLAB Function, or S-function block
getBlockSimState Access SimState of individual Stateflow Chart, MATLAB Function, or S-function block
add_exec_event_listener Register listener for block method execution event
Simulink.SimState.ModelSimState Access SimState snapshot data

Visualize Results

find Find nonzero elements in array
get Access and display values of simulation results
who List names of top-level data logging objects in Simulink data log
model Include model as block in another model
Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object

Export Runtime Information

Data Export Basics

Simulink.SimulationData.BlockPath Fully specified Simulink block path
Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object
Simulink.SimulationData.Signal Container for signal logging information
Simulink.SimulationData.State State logging element
Simulink.SimulationOutput Access object values of simulation results

Signal Logging

Simulink.ModelDataLogs.convertToDataset Convert logging data from Simulink.ModelDataLogs format to Simulink.SimulationData.Dataset format
Simulink.SimulationData.signalLoggingSelector Open Signal Logging Selector
Simulink.SimulationData.updateDatasetFormatLogging Convert model and its referenced models to use Dataset format for signal logging
unpack Extract signal logging objects from signal logs and write them into MATLAB workspace
Simulink.SimulationData.createStructOfTimeseries Create a structure with MATLAB timeseries object leaf nodes
who List names of top-level data logging objects in Simulink data log
whos List names and types of top-level data logging objects in Simulink data log
Simulink.ModelDataLogs Container for signal data logs of a model
Simulink.SimulationData.BlockPath Fully specified Simulink block path
Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object
Simulink.SimulationData.LoggingInfo Signal logging override settings
Simulink.SimulationData.ModelLoggingInfo Signal logging override settings for a model
Simulink.SimulationData.Signal Container for signal logging information
Simulink.SimulationData.SignalLoggingInfo Signal logging override settings for signal
Simulink.SimulationMetadata Access metadata of simulation runs
Simulink.SimulationOutput Access object values of simulation results
Simulink.SubsysDataLogs Container for subsystem's signal data logs
Simulink.TimeInfo Provide information about time data in Simulink.Timeseries object
Simulink.Timeseries Store data for any signal except mux or bus signal
Simulink.TsArray Store data for mux or bus signal

Validate System Behavior

Simulink.sdi.view Open Simulation Data Inspector
Simulink.sdi.addToRun Add new simulation data to existing run
Simulink.sdi.clear Clear all data from Simulation Data Inspector
Simulink.sdi.close Close Simulation Data Inspector
Simulink.sdi.compareRuns Compare signal data between two simulation runs
Simulink.sdi.compareSignals Compare data from two signals
Simulink.sdi.copyRun Create copy of run including simulation output data
Simulink.sdi.createRun Create run in Simulation Data Inspector
Simulink.sdi.deleteRun Delete run from Simulation Data Inspector
Simulink.sdi.getRun Return Simulink.sdi.Run object containing simulation output data
Simulink.sdi.getRunCount Return number of runs in Simulation Data Inspector
Simulink.sdi.getRunIDByIndex Return the run ID corresponding to run index
Simulink.sdi.getRunNamingRule Return run naming rule for next Simulation Data Inspector run
Simulink.sdi.getSignal Return Simulink.sdi.Signal object for signal in Simulation Data Inspector
Simulink.sdi.getSource Return location for storing simulation data
Simulink.sdi.isValidRunID Determine if run ID is valid
Simulink.sdi.load Load saved Simulation Data Inspector session
Simulink.sdi.refresh Refresh Simulation Data Inspector
Simulink.sdi.report Generate report from Simulation Data Inspector tool
Simulink.sdi.resetRunNamingRule Reset default run naming rule for next Simulation Data Inspector run
Simulink.sdi.save Save current Simulation Data Inspector session
Simulink.sdi.setRunNamingRule Specify a run naming rule
Simulink.sdi.setRunOverwrite Mark simulation run for overwrite
Simulink.sdi.setSource Set location for storing simulation data
Simulink.sdi.DiffRunResult Results from comparing two simulation runs
Simulink.sdi.DiffSignalResult Results from comparing two signals
Simulink.sdi.Run Manages signal data and metadata of simulation run
Simulink.sdi.Signal Manages signal time series data and metadata
Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object

Trimming and Linearization

trim Find trim point of dynamic system
dlinmod Extract discrete-time linear state-space model around operating point
linmod Extract continuous-time linear state-space model around operating point
linmod2 Extract continuous-time linear state-space model around operating point
linmodv5 Extract continuous-time linear state-space model around operating point
getInitialState Return initial state structure of block diagram

Test and Debug

Diagnostics

sldiagviewer.diary Log simulation warnings and errors and build information to file
sldiagnostics Display diagnostic information about Simulink system
Simulink.BlockDiagram.getChecksum Return checksum of model
Simulink.SubSystem.getChecksum Return checksum of nonvirtual subsystem
modeladvisor Open Model Advisor
sldebug Start simulation in debug mode
addterms Add terminators to unconnected ports in model

Signal Analysis

signalbuilder Create and access Signal Builder blocks
disableimplicitsignalresolution Convert model to use only explicit signal resolution

Debugging

sldebug Start simulation in debug mode

Performance

Automated Performance Optimization

performanceadvisor Open Performance Advisor

Acceleration

sim Simulate dynamic system
set_param Set system and block parameter values
Simulink.BlockDiagram.buildRapidAcceleratorTarget Build Rapid Accelerator target for model and return run-time parameter set
Simulink.BlockDiagram.getChecksum Return checksum of model
Simulink.SubSystem.getChecksum Return checksum of nonvirtual subsystem
slbuild Build standalone executable or model reference target for model

Manual Performance Optimization

slprofreport Regenerate profiler report from data, ProfileData, saved from previous run
sldiagnostics Display diagnostic information about Simulink system

Component-Based Modeling

Model Architecture

Subsystems

Simulink.BlockDiagram.createSubSystem Create subsystem containing specified set of blocks
Simulink.BlockDiagram.copyContentsToSubSystem Copy contents of block diagram to empty subsystem
Simulink.BlockDiagram.expandSubsystem Expand subsystem contents to containing model level
Simulink.SubSystem.convertToModelReference Convert subsystem to model reference
Simulink.SubSystem.copyContentsToBlockDiagram Copy contents of subsystem to empty block diagram
Simulink.SubSystem.deleteContents Delete contents of subsystem

Libraries

libinfo Get information about library blocks referenced by model
gcb Get pathname of current block
gcbh Get handle of current block

Model Reference

find_mdlrefs Find Model blocks and referenced models at all levels or at top level only
view_mdlrefs Display graph of model reference dependencies
Simulink.SubSystem.convertToModelReference Convert subsystem to model reference
slbuild Build standalone executable or model reference target for model
Simulink.BlockPath Fully specified Simulink block path

Data Stores

Simulink.SimulationData.DataStoreMemory Container for data store logging information
Simulink.ModelDataLogs Container for signal data logs of a model
Simulink.SimulationData.BlockPath Fully specified Simulink block path
Simulink.SimulationData.Dataset Create Simulink.SimulationData.Dataset object

Composite Signals

Simulink.BlockDiagram.addBusToVector Add Bus to Vector blocks to convert virtual bus signals into vector signals
Simulink.Bus.cellToObject Convert cell array containing bus information to bus objects
Simulink.Bus.createMATLABStruct Create MATLAB structures using same hierarchy and attributes as bus signals
Simulink.Bus.createObject Create bus objects from blocks or MATLAB structures
Simulink.Bus.objectToCell Convert bus objects to cell array containing bus information
Simulink.Bus.save Save bus objects in MATLAB file
slreplace_mux Replace Mux blocks used to create buses with Bus Creator blocks
Simulink.Bus Specify properties of signal bus
Simulink.BusElement Describe element of signal bus

Configuration Reuse

attachConfigSet Associate configuration set or configuration reference with model
attachConfigSetCopy Copy configuration set or configuration reference and associate it with model
detachConfigSet Dissociate configuration set or configuration reference from model
getActiveConfigSet Get model's active configuration set or configuration reference
getConfigSet Get one of model's configuration sets or configuration references
getConfigSets Get names of all of model's configuration sets or configuration references
setActiveConfigSet Specify model's active configuration set or configuration reference
Simulink.BlockDiagram.loadActiveConfigSet Load, associate, and activate configuration set with model
Simulink.BlockDiagram.saveActiveConfigSet Save active configuration set of model
set_param Set system and block parameter values
get_param Get parameter names and values
Simulink.ConfigSet Access model configuration set
Simulink.ConfigSetRef Link model to configuration set stored independently of any model

Variant Systems

Simulink.Variant Specify a model reference variant and its execution environment
Simulink.VariantConfigurationData Class representing a variant configurations data object

Project Management

Simulink Project Setup

simulinkproject Open Simulink Project and get project object
slproject.loadProject Load Simulink project
slproject.getCurrentProject Manipulate current Simulink Project at command line
addFile Add file to Simulink Project
close Close Simulink Project
export Export Simulink Project to zip
findFile Get Simulink Project file by name
isLoaded Determine if Simulink Project is loaded
reload Reload Simulink Project
removeFile Remove file from Simulink Project

Simulink Project File Management

simulinkproject Open Simulink Project and get project object
slproject.loadProject Load Simulink project
addFile Add file to Simulink Project
addLabel Attach label to Simulink Project file
close Close Simulink Project
createCategory Create category of Simulink Project labels
createLabel Define Simulink Project label
export Export Simulink Project to zip
findCategory Get Simulink Project category of labels
findFile Get Simulink Project file by name
findLabel Get Simulink Project file label
isLoaded Determine if Simulink Project is loaded
reload Reload Simulink Project
removeCategory Remove Simulink Project category of labels
removeFile Remove file from Simulink Project
removeLabel Remove label from Simulink Project

Dependency Analysis

simulinkproject Open Simulink Project and get project object
dependencies.fileDependencyAnalysis Find model file dependencies
dependencies.toolboxDependencyAnalysis Find toolbox dependencies

Source Control in Simulink Project

simulinkproject Open Simulink Project and get project object
Simulink.getFileChecksum Checksum of file

Model Exploration

Simulink.MDLInfo Extract model file information without loading block diagram into memory
Simulink.MDLInfo.getDescription Extract model file description without loading block diagram into memory
Simulink.MDLInfo.getMetadata Extract model file metadata without loading block diagram into memory

Modeling Guidelines

Model Upgrades

upgradeadvisor Open Upgrade Advisor
slupdate Replace blocks from previous releases with latest versions

Block Creation

Block Masks

Simulink.Mask Control masks programmatically
Simulink.MaskParameter Control mask parameters programmatically

Custom MATLAB Algorithms

MATLAB Algorithm Design

Algorithm Design Basics
coder.allowpcode Control code generation from protected MATLAB files
coder.ceval Call external C/C++ function
coder.cinclude Include header file in generated code
coder.cstructname Specify structure name in generated code
coder.extrinsic Declare extrinsic function or functions
coder.inline Control inlining in generated code
coder.load Load compile-time constants from MAT-file or ASCII file into caller workspace
coder.nullcopy Declare uninitialized variables
coder.opaque Declare variable in generated code
coder.ref Pass argument by reference as read input or write output
coder.rref Pass argument by reference as read-only input
coder.target Determine if code generation target is specified target
coder.unroll Copy body of for-loop in generated code for each iteration
coder.varsize Declare variable-size data
coder.wref Pass argument by reference as write-only output
Data Definition
Variable-Size Data
coder.varsize Declare variable-size data
coder.typeof Convert MATLAB value into its canonical type
Structures
coder.cstructname Specify structure name in generated code
Function Definition
coder.extrinsic Declare extrinsic function or functions

Code Generation

coder.allowpcode Control code generation from protected MATLAB files
coder.ceval Call external C/C++ function
coder.cinclude Include header file in generated code
coder.const Fold expressions into constants in generated code
coder.cstructname Specify structure name in generated code
coder.extrinsic Declare extrinsic function or functions
coder.inline Control inlining in generated code
coder.load Load compile-time constants from MAT-file or ASCII file into caller workspace
coder.opaque Declare variable in generated code
coder.ref Pass argument by reference as read input or write output
coder.rref Pass argument by reference as read-only input
coder.screener Determine if function is suitable for code generation
coder.target Determine if code generation target is specified target
coder.unroll Copy body of for-loop in generated code for each iteration
coder.wref Pass argument by reference as write-only output
coder.updateBuildInfo Update build information object RTW.BuildInfo
coder.ExternalDependency Interface to external code
coder.BuildConfig Build context during code generation

Performance

coder.inline Control inlining in generated code
coder.unroll Copy body of for-loop in generated code for each iteration
coder.const Fold expressions into constants in generated code

Legacy Code Integration

legacy_code Use Legacy Code Tool

Host-Specific Code

MATLAB S-Functions

Simulink.MSFcnRunTimeBlock Get run-time information about Level-2 MATLAB S-function block
Simulink.RunTimeBlock Allow Level-2 MATLAB S-function and other MATLAB programs to get information about block while simulation is running
Simulink.BlockData Provide run-time information about block-related data, such as block parameters
Simulink.BlockPortData Describe block input or output port
Simulink.BlockCompDworkData Provide postcompilation information about block's DWork vector
Simulink.BlockCompInputPortData Provide postcompilation information about block input port
Simulink.BlockCompOutputPortData Provide postcompilation information about block output port
Simulink.BlockPreCompInputPortData Provide precompilation information about block input port
Simulink.BlockPreCompOutputPortData Provide precompilation information about block output port

System Object Integration

Define System Objects

Basic Operations
matlab.System Base class for System objects
matlab.system.mixin.FiniteSource Finite source mixin class
matlab.system.StringSet Set of valid string values
Properties and States
matlab.System Base class for System objects
matlab.system.StringSet Set of valid string values
Load, Save, and Clone
matlab.System Base class for System objects
System Block
Icon and Dialog
matlab.System Base class for System objects
matlab.system.mixin.CustomIcon Custom icon mixin class
matlab.system.display.Action Custom button
matlab.system.display.Header Header for System objects properties
matlab.system.display.Section Property group section for System objects
matlab.system.display.SectionGroup Section group for System objects
Output Specifications
matlab.System Base class for System objects
matlab.system.mixin.Propagates Signal characteristics propagation mixin class
Nondirect Feedthrough
matlab.System Base class for System objects
matlab.system.mixin.Nondirect Nondirect feedthrough mixin class
For Each Subsystem
matlab.System Base class for System objects
Was this topic helpful?