App Designer Image Properties

2 Ansichten (letzte 30 Tage)
Trevor
Trevor am 5 Jul. 2023
Kommentiert: Trevor am 6 Jul. 2023
Is there a way to hide all or several images at the same time?
I am writing code to hide/show certain images of a map based on user selection. Is there a more efficient way to do this? My current solution is writing several separate app.mapname.visible = 'off' lines for each image. There will be likely 100s of images used.
% Value changed function: ChooseBayDropDown
function ChooseBayDropDownValueChanged(app, event)
value = app.ChooseBayDropDown.Value;
switch value
case 'Bay 1 - Receiving'
app.bay1_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 2 - Heat Room'
app.bay2_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay1_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 3 - A-Plant'
app.bay3_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
app.bay4_map.Visible = 'off';
case 'Bay 4 - Hot Cast'
app.bay4_map.Visible = 'on';
app.blank_map.Visible = 'off';
app.bay1_map.Visible = 'off';
app.bay2_map.Visible = 'off';
app.bay3_map.Visible = 'off';
end
Thanks!

Akzeptierte Antwort

Kevin Holly
Kevin Holly am 5 Jul. 2023
You can use findall to get a handle of all the uiimages.
handle = findall(app.UIFigure,'Type','uiimage');
for ii = 1:length(handle)
handle(ii).Visible = "off";
end

Weitere Antworten (0)

Kategorien

Mehr zu Image Processing Toolbox finden Sie in Help Center und File Exchange

Produkte


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by