​​Simulink® model elements as objects​

Version 1.0.1 (133 KB) by Ken Xu
Represent Simulink® model elements as MATLAB® objects, with enhanced search and batch operation capabilities.
9 Downloads
Updated 4 Mar 2024

View License

Simulink® Model Elements as MATLAB® Objects
Introduction
The slelement package is a working prototype for the ideas of
1. Representing Simulink model elements as MATLAB objects, usable with Simulink APIs (get_param, add_block, etc)
2. Searching model elements with an extensible sementic
3. Doing batch operations on model elements
Examples
Complete API cheatsheet, and live demos are under the doc directory. Below is just a sample of what you can do.
Making objects out of identifiers
Use the "makeElement" helper to create model element objects.
mdl = slelement.makeElement('modelname')
blk = slelement.makeElement('modelname/blockname')
Finding elements and performing batch operations
Find all the ports connected to outport blocks:
element_selector = ...
Ports('porttype','outport') > ... % all output ports connected to
( Blocks('blocktype','Outport') | ... % outport blocks'
Ports('porttype','inport') ); % inports
outport_inputs = mdl.select(element_selector);
Turn on port value labels for all of them:
outport_inputs.set('ShowValueLabel','on');
Copyright 2024 The MathWorks, Inc.

Cite As

Ken Xu (2024). ​​Simulink® model elements as objects​ (https://www.mathworks.com/matlabcentral/fileexchange/160606-simulink-model-elements-as-objects), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2024a
Compatible with R2017b and later releases
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

+slelement

+slelement/+elementGetters

+slelement/+selector

+slelement/+selector/+operation

+slelement/+selector/+operation/@Operation

+slelement/+selector/+operation/@OperationDispatcher

+slelement/+selector/@SelectorComponent

+slelement/+selector/@SelectorComposite

+slelement/@Element

+slelement/@ElementInterface

Version Published Release Notes
1.0.1

Fixed uploaded file.

1.0.0