App Designer Image Properties

조회 수: 2 (최근 30일)
Trevor
Trevor 2023년 7월 5일
댓글: Trevor 2023년 7월 6일
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!

채택된 답변

Kevin Holly
Kevin Holly 2023년 7월 5일
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by