Please can you upload the Simulink model on which you are trying this code?
Simulink block Mask Dialog Image updating
3 次查看(过去 30 天)
显示 更早的评论
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Author Block Masks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!