Copy Block Mask GUI from Model to MATLAB App

2 visualizaciones (últimos 30 días)
Daniel Flisek
Daniel Flisek el 30 de Oct. de 2024
Respondida: Divyajyoti Nayak el 19 de Nov. de 2024
I have a MATLAB app that interfaces with Simulink models. The app reads the model to determine what inputs the model needs, then creates and displays edit fields in the app GUI for user input. When the app runs the model, it passes the values of these variables to the model's local workspace. Right now, the app just grabs all the input blocks, makes edit fields for all of them, and puts them all on the GUI in whatever order they come in.
Some models, however, have inputs that should be grouped together in the app GUI. Instead of hard coding the app for certain situations, I would like to create a block mask in the model and "import" that into the app GUI. The app would copy and paste the mask GUI into an empty space in a grid layout.
I can group inputs together however I like in the block mask, and I want those groupings to be transferred to the app. This way the app doesn't need to know anything about the model or its inputs; it just has to grab and display the mask.
Is it possible to programmatically retrieve the block mask GUI from a Simulink model, and directly use it in a MATLAB App?

Respuestas (1)

Divyajyoti Nayak
Divyajyoti Nayak el 19 de Nov. de 2024
Hi Daniel,
To programmatically get the mask of any block in a Simulink model, the ‘get’ function of the ‘Simulink.Mask’ class can be used. Here’s the documentation and some sample code to help you out:
openExample('simulink_masking/MaskLookupTableControlExample')
Simulink.Mask.get('slexMaskLookupTableControlExample/LUT Control with Explicit Data');

Categorías

Más información sobre Author Block Masks en Help Center y File Exchange.

Productos


Versión

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by