Programmatic Model Editing

Create models, add and connect blocks in models, set parameters and properties, and perform other modeling basics programmatically

Learn the basics of programmatic model management in Simulink®.

Functions

expand all

simulinkOpen Simulink Start Page
start_simulinkStart Simulink without opening any windows
slLibraryBrowserOpen Simulink Library Browser
open_systemOpen model, library, subsystem, or block dialog box
load_systemLoad Simulink model into memory
save_systemSave Simulink model
close_systemClose Simulink system window or block dialog box
bdcloseClose any or all Simulink system windows unconditionally
add_blockAdd block to model
add_lineAdd line to Simulink model
delete_blockDelete blocks from Simulink system
delete_lineDelete line from Simulink model
add_paramAdd parameter to Simulink system
delete_paramDelete system parameter added via add_param command
Simulink.BlockDiagram.deleteContentsDelete contents of block diagram
Simulink.SubSystem.deleteContentsDelete contents of subsystem
new_systemCreate Simulink model or library in memory
Simulink.createFromTemplateCreate model or project from template
Simulink.BlockDiagram.createSubsystemCreate subsystem containing specified set of blocks
docblockGet or set editor invoked by Simulink DocBlock
gcsGet path name of current system
getfullnameGet pathname of block or line
gcbGet path name of current block
gcbhGet handle of current block
gcbpGet Simulink.BlockPath object for current block
getSimulinkBlockHandleGet block handle from block path
Simulink.ID.getHandleGet handle of block, annotation, or Stateflow object
Simulink.ID.getSIDGet Simulink Identifier of block, annotation, or Stateflow object
get_paramGet parameter names and values
set_paramSet system and block parameter values
Simulink.defaultModelTemplateSet or get default model template
getCallbackAnnotationGet annotation executing callback
edittime.getDisplayIssuesCheck whether model design warnings and errors is on
edittime.setDisplayIssuesDetect model design errors and warnings
hilite_systemHighlight block, signal line, port, or annotation
Simulink.ID.hiliteHighlight block, annotation, or Stateflow object
find_systemFind systems, blocks, lines, ports, and annotations
Simulink.findTemplatesFind model or project templates with specified properties
Simulink.allBlockDiagramsFind loaded Simulink models and libraries
Simulink.findBlocksFind blocks in Simulink models
Simulink.findBlocksOfTypeFind specified type of block in Simulink models
replace_blockReplace blocks in Simulink model
bdrootTop-level model of current system
bdIsLoadedWhether block diagram is in memory
bdIsLibraryWhether block diagram is a library
bdIsDirtyWhether block diagram has unsaved changes
slIsFileChangedOnDiskDetermine whether model has changed since it was loaded
Simulink.SubSystem.copyContentsToBlockDiagramCopy contents of subsystem to empty block diagram
Simulink.exportToTemplateCreate template from model or project
Simulink.exportToVersionExport model or library for use in previous version of Simulink
Simulink.MDLInfoExtract model file information without loading block diagram into memory
Simulink.MDLInfo.getDescriptionExtract model file description without loading block diagram into memory
Simulink.MDLInfo.getMetadataExtract model file metadata without loading block diagram into memory
Simulink.BlockDiagram.expandSubsystemReplace subsystem with subsystem contents
Simulink.BlockDiagram.arrangeSystemImprove layout of model or subsystem
Simulink.BlockDiagram.routeLineRoute existing lines of a model
slCharacterEncodingChange MATLAB character set encoding
frameeditEdit print frames for Simulink and Stateflow block diagrams
orientPaper orientation for printing or saving
printPrint figure or save to specific file format

Classes

Simulink.AnnotationSpecify properties of model annotation
Simulink.FindOptionsOptions for finding blocks in models and subsystems

Topics

Simulink API

Programmatic Modeling Basics

Create models, add and connect blocks in models, set parameters and properties, and perform other modeling basics programmatically.

Run Simulations Programmatically

Programmatically simulate a model using the sim function.