AppDesigner Error "Functionality not supported with figures created with the uifigure function" only when opening distributed .exe on other devices.

조회 수: 25 (최근 30일)
I am having an issue where my GUI crashes a few seconds afler opening on other devices. This only occurs when the packaged .exe is opened on devices other than my own, both when Runtime is preinstalled or installed upon opening. The error "Functionality not supported with figures created with the uifigure function" is stated to occur when my startupFcn, shown below, attempts to run. What could be causing this issue? The GUI works 100% fine on my device when run either directly from AppDesigner or from the .exe. It also works fine when the code si run from AppDesigner on other machines.
% Fix window sizing bugs
warning off MATLAB:ui:uifigure:UnsupportedAppDesignerFunctionality
set(0,'units','pixels');
Pix_SS = get(0,'screensize');
k_vert=Pix_SS(4)/1080;
k_hor=Pix_SS(3)/1920;
%k_vert=0.75;
%k_hor=0.6;
uisize = app.UIFigure.Position;
screenWidth = uisize(3);
screenHeight = uisize(4);
left = uisize(1);
bottom = uisize(2);
width = screenWidth*k_hor;
height = screenHeight*k_vert;
k_font=(k_hor+k_vert)/2;
drawnow;
comp=app.UIFigure.Children;
app.UIFigure.Position = [left bottom width height];
assignin('base', 'pos', app.UIFigure.Position);
assignin('base', 'compp', app.UIFigure.Children);
for i=1:numel(comp)
app.UIFigure.Children(i).Position(3)=comp(i).Position(3)*k_hor;
app.UIFigure.Children(i).Position(4)=comp(i).Position(4)*k_vert;
app.UIFigure.Children(i).Position(1)=comp(i).Position(1)*k_hor;
app.UIFigure.Children(i).Position(2)=comp(i).Position(2)*k_vert;
try
a{i} = comp(i).FontSize;
catch
warning('This object does not have font option. Assigning a value of 0.');
a{i} = 0;
end
if a{i}~=0
app.UIFigure.Children(i).FontSize=comp(i).FontSize*k_font;
end
end
  댓글 수: 4
Kevin Holly
Kevin Holly 2022년 6월 21일
Were you able to compile other apps to a standalone executable and succesfully run it on other devices with the same operating system?
Michael Sudol
Michael Sudol 2022년 6월 22일
@Kevin Holly Yes, I was able to package and run both premade apps as well as other ones of my own on my own device as well as others. I've tried deleting the entirety of the startupFcn and it does now successfully run on other devices, but the spacing and sizing can get a bit weird on different resolution screens.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Install Products에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by