.m callback to app designer issue

2 ビュー (過去 30 日間)
Ryan Sandberg
Ryan Sandberg 2018 年 11 月 27 日
When I call a .m file from the app designer, in this case a listener handle the callback from the .m file to the app instantiates the startupFcn and makes a new figure. Is there a way to avoid or suppress this? I can get around this by deleting the new figure, but now the app has a "flashing" feel every time the file under watch is updated
methods (Access = private)
% Code that executes after component creation
function startupFcn(app)
global mylistener;
global file;
getcaller=dbstack();
mycaller=getcaller(5).name;
switch mycaller
case {'eventhandlerChanged'}
temp=findall(0,'Type','figure');
delete(temp(2));
case {'AppManagementService.runAppWithTryCatch'}
filepath='C:\test';
file=System.IO.FileSystemWatcher(filepath);
file.Filter='November2018.txt';
file.EnableRaisingEvents=true;
mylistener=addlistener(file,'Changed',@eventhandlerChanged);
app.Label2.Text='NOT UPDATED';
app.Label.Text='';
app.Label3.Text='';
end
end
function eventhandlerChanged(~,h1)
MainFunction(app1,h1);
end

回答 (0 件)

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by