File Exchange

image thumbnail


version 1.7.0 (80.9 KB) by Robert Rasche
easy-as-pie API to Simulink


Updated 10 Feb 2020

GitHub view license on GitHub

Editor's Note: This file was selected as MATLAB Central Pick of the Week

easy-as-pie API for Simulink models

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.

Scripted manipulation of Simulink models had always required tons and tons of API-calls, awkward management of block handles vs. pathes, loops and subroutines for dealing with ports/lines or mux-/bus-signals. Dealing with Subsystem levels. In all this code, the main idea of what is being done cannot stand out clearly.

slQuery brings you two major tools that make scripted interaction with models a lot easier and cleaner.

1) slQuery is a query-language inspired by CSS/jQuery, XPath and regex that allows searching a loaded Simulink model for groups of blocks (called "situational patterns") that satisfy certain conditions and have certain relations to each other.

2) slQuery wraps arrays of Simulink block handles into lightweight "objects" that can be used to access block parameters and structural features in a syntactically pleasing way.

Cite As

Robert Rasche (2020). slQuery (, GitHub. Retrieved .

Comments and Ratings (1)

Franz Ruff



add colon-operator for retrieving port- and line-handles of blocks
add basic support for Simscape physical connection modelling
add support for TargetLink properties in query-syntax


ability to reference block parameters of previous selectors
more flexible port/line retrieval with colon-operator

MATLAB Release Compatibility
Created with R2018b
Compatible with any release
Platform Compatibility
Windows macOS Linux