Simulink block Mask Dialog Image updating

3 ビュー (過去 30 日間)
Robert Simpson
Robert Simpson 2017 年 2 月 17 日
コメント済み: Hari Desanur 2017 年 2 月 22 日
How do i force an image in a mask dialog to update/redraw?
I have a simple Simulink block Mask dialog with a popup and an image. I want to change the image based on the value in the popup The code in the popup callback is as below.
maskParams = Simulink.Mask.get(gcb);
selected = get_param(gcb,'popupMenu');
schematic = maskParams.getDialogControl('imageControl');
schematic.FilePath = ['.\pathtoImageFiles\' selected '.png']
set_param(gcb,'actuatorType',selected); %try to force intialisation
schematic.Enabled = 'off';
schematic.Enabled = 'on';
schematic.Visible = 'off';
schematic.Visible = 'on';
However, what actually happens is that the schematic. Filepath parameter gets updated correctly but the image does not get updated until the mask is closed and then opened again. How do I manually update the image?
Also removeDialogControl does not seem to work on the image so I cant remove the whole ImageDialogControl and then add another one.
  1 件のコメント
Hari Desanur
Hari Desanur 2017 年 2 月 22 日
Please can you upload the Simulink model on which you are trying this code?

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

回答 (0 件)

カテゴリ

Help Center および File ExchangeAuthor Block Masks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by