Simulink block Mask Dialog Image updating

3 views (last 30 days)
Robert Simpson
Robert Simpson on 17 Feb 2017
Commented: Hari Desanur on 22 Feb 2017
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 Comment
Hari Desanur
Hari Desanur on 22 Feb 2017
Please can you upload the Simulink model on which you are trying this code?

Sign in to comment.

Answers (0)

Categories

Find more on Author Block Masks in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!