Simulink block Mask Dialog Image updating

3 Ansichten (letzte 30 Tage)
Robert Simpson
Robert Simpson am 17 Feb. 2017
Kommentiert: Hari Desanur am 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 Kommentar
Hari Desanur
Hari Desanur am 22 Feb. 2017
Please can you upload the Simulink model on which you are trying this code?

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Author Block Masks finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by