Matlab APPS, opened GUI figure and Matlab won't close

48 次查看(过去 30 天)
I'm trying to use the Matlab APPS ability. I have an application which runs fine. When it is finished, I hit the MS-x in the corner to close it and it gives me this error:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Error using @(hObject,eventdata)machineControlGui('controlPanel_CloseRequestFcn',hObject,eventdata,guidata(hObject)) Not enough input arguments.
Error in appinstall.internal.stopapp (line 7) feval(obj.ExistCloseFcn);
Error while evaluating figure CloseRequestFcn
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
The application runs fine on it's own and will close without hassle if not run under the APPS tab, but running it as an "APPS" causes the error and it won't close and I can't close Matlab either unless I kill the process using task manager.
I am using the application to control instruments and take data. It is quite a few long functions which are in separate files. I have downloaded another APPS and installed it without this problem. All that APPS functionality is contained in one m-file as opposed to mine, which is in several files, text files and excel files. I just can't close it....

采纳的回答

Sean de Wolski
Sean de Wolski 2013-3-26
编辑:Sean de Wolski 2013-3-26
In R2012b this was a bug with GUIDE GUIs containing custom close request functions.
You can either upgrade to 13a, or remove the CloseRequestFcn and put that code in the DeleteFcn.
  4 个评论
Mike
Mike 2013-3-27
But that code has been running like that for years. It has never been "all". Why suddenly is is necessary to fclose(all)?
Sean de Wolski
Sean de Wolski 2013-3-27
I have no idea, I haven't seen the code. Is it possible that this piece of code was never run until now?
If you do:
dbstop if error
Run it and stop on the faulty line, what is the line of code?

请先登录,再进行评论。

更多回答(3 个)

AMAR P
AMAR P 2018-9-25
For 2015a and above Users:
set(0,'ShowHiddenHandles','on')
delete(get(0,'Children'))

Mike
Mike 2013-3-27
编辑:Mike 2013-3-27
I think it is the NI software. I have another machine it is running fine on using 2013a, but it has a file loaded which is called NI-USI2.0.0.4901, which is missing from the machine that has the error. It calls it the Universal Storage Interface (USI), though I can't see what storage would have to do with it, but maybe something didn't install correctly. Here is the Matlab code:
for countPort = 1:10;
port = ['COM', num2str(countPort)];
try
% OPSens = serial(port);
OPSens = visa('ni',port); < First error here.. RSCNAME
get(OPSens);
set(OPSens,'timeout',5);
%OPSens.terminator = 10;%linefeed (LF) character (ASCII hexadecimal <0x0A>)
fopen(OPSens);
serialUnitID = query(OPSens, 'SYST:IDN?');
% if error(lastwarn); % serialUnitID == [];
if isempty(serialUnitID);
error('COM port tricks eh?');
else
comPortGold = 1;
useThisComPort = port;
break;
end
catch err
% Try a different port.
fclose(OPSens);
lastwarn(''); % reset warning message
end
end

Mike
Mike 2013-4-1
For what ever reason, suddenly the VISA drivers and Matlab interaction are not talking to the USB port and the object is not opening at all, so it cannot "fclose" the empty object. Somehow I was able to get the 2 machines to start behaving Friday. Now 1 of them has reverted back and is not working. The National Instruments software works fine to test the port, just opening it through Matlab isn't working.
  2 个评论
Sean de Wolski
Sean de Wolski 2013-4-2
Mike, this is really the subject for a new question. Posting to an answered question reduces visibility.
Mike
Mike 2013-4-3
I did a new question. Not a single input. Will open a service request.

请先登录,再进行评论。

Community Treasure Hunt

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

Start Hunting!

Translated by