Nota del editor: This file was selected as MATLAB Central Pick of the Week
slQuery - the "easy-as-pie" API to Simulink
slQuery
is a "slickness-layer" ontop of the find_system
and get/set_param
API-functions
and various related features of Simulink. It resulted from several inconveniences i had to deal
with, while writing scripts that interact with and modify model structures.
slQuery
brings you two major tools that make scripted interaction with models very easy and
clean.
-
slQuery
is a query language inspired by CSS/jQuery, XPath and regex that allows searching a Simulink model for groups of blocks that satisfy certain conditions and relations to each other. -
slQuery
wraps arrays of Simulink block handles into lightweight "proxy objects" that can be used to access block parameters and structural features in a syntactically pleasing way.
Have a look: This small example script shows how to interact with a model using slQuery
. It
acts on the two plain blocks given on the left side and step-by-step transforms them to become
the Simulink logo on the right.
But this only the beginning! For a detailed description of what slQuery
allows you to do, go
to the documentation and reference pages section.
Installation
slQuery
is implemented as a crazily compact single class
file, that you just put onto the
MATLAB search path somewhere. You can download and install the script in your local scripts
folder using the following command.
websave(fullfile(uigetdir, '/slQuery.m'), 'https://raw.githubusercontent.com/arinar/slQuery/master/slQuery.m')
This will give you all the slQuery
-features.
To also have the documentation and tests available locally, clone this repositiory or download
the .zip and then use the pathtool
command to add it to the MATLAB search path.
Bugs or Contributions
Report bugs or missing features of slQuery
as well as ideas or code via the project page on
github.
Or contact me directly via robert with a circle-a then raschhour followed by the dotcom.
slQuery and TargetLink
At my job, I've been working with the dSPACE TargetLink production code
generator a lot. slQuery
is to a great extent the result of me recognizing and refining best practices and code patterns
for an efficient automation of tedious modelling tasks. Scripting is often the only feasible
way to handle systematic changes to our code generation basis models. The TargetLink block data
API is in my opinion just as not-slick as the Simulink API and so, more expressive means of
interacting with this data were needed as well. Therefore TargetLink has a special place in
slQuery
's heart.
Both the query language and proxy object magic do support access and manipulation of the
TargetLink block data. This access is made possible via the special [tl.〈tab〉.〈prop〉=...]
parameters in the query and
.tl.〈tab〉.〈prop〉
subscript syntax of
the wrapper objects.
slQuery
's baby sister project ddQuery
provides a
similar tooling for the TargetLink Data Dictionary, which is oftentimes even more useful in
this context.
Citar como
Robert Rasche (2024). slQuery (https://github.com/arinar/slQuery), GitHub. Recuperado .
Compatibilidad con la versión de MATLAB
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
test
test
No se pueden descargar versiones que utilicen la rama predeterminada de GitHub
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.10.0.1 | * line-connect features
|
|
|
1.10.0 | * line-connect features
|
|
|
1.9.0 | * fix/add combinator "=" support for phyiscal signal routing
|
|
|
1.8.0 | * explicit text for hyperlink
|
|
|
1.7.0 | add colon-operator for retrieving port- and line-handles of blocks
|
|
|
1.5.0 | ability to reference block parameters of previous selectors
|
|
|
1.4.0 |
|