.m callback to app designer issue

2 visualizaciones (últimos 30 días)
Ryan Sandberg
Ryan Sandberg el 27 de Nov. de 2018
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

Respuestas (0)

Categorías

Más información sobre Develop Apps Using App Designer en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by