Copy Block Mask GUI from Model to MATLAB App
38 ビュー (過去 30 日間)
古いコメントを表示
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?
0 件のコメント
回答 (1 件)
Divyajyoti Nayak
2024 年 11 月 19 日 4:11
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');
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Create Block Masks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!