Is there a way to add another button to a mask in Simulink?

1 回表示 (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
コメント済み: Arthur Roué 2023 年 5 月 11 日
I am looking for a way to add another button to a mask dialog. For example, I want a button that will plot a preview of some data that is dependent on settings in the mask. Is there a way to add a button and then customize the callback similar to a GUI in MATLAB?

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
The ability to add a button to a mask is not available in Simulink.
To work around this issue, a parameter can be added to the mask and a checkbox can be used to display the plot. The example below demonstrates how this can be done.
A dialog parameter of type 'checkbox' controls the creation of a plot. Double-clicking on the block in the model will open the mask dialog. Checking the checkbox will create a plot.
The following code was added to the OpenFcn callback for the block:
set_param(gcb,'showPlot','off');
open_system(gcb,'mask');
This ensures the checkbox is always set to 'off' when the block is opened preventing the plot from being created if it was checked from a previous opening of the mask dialog.
  3 件のコメント
Arthur Roué
Arthur Roué 2023 年 3 月 20 日
Any update for R2022a ? It seems not, but I hope I'm wrong.
Arthur Roué
Arthur Roué 2023 年 5 月 11 日
Thanks for your answer, but I just realised I did not ask the right question. I want to add a button directly on the Simulink block, just like the "Look under mask" arrow down. Is this possible ?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSources についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by