Sunday 15 September 2013

function - Matlab: How to close program legaly? -


I have a script running with many graphical handles, which I update in code here and there. My purpose is that when I close the program with Brutilla (with X button or Ctrl C) it will have to close it correctly.

I have overridden the default close function, even when sometimes I "handle invalid objects" when pressing it or pressing Ctrl + C.

I have a number of handles in the code, each should be checked or is there any other way to close this figure and the code is correct? (With something like 'quitting' but with close mateab IDE)

Thank you, boy.

You can validate the handle with isvalid Can check. You need a loop on your handle, check their validity, and close them if valid; You should probably have to push a ... try ... for good measure there over Something like this:

  function id1_DeleteFcn (hObject, eventdata, handle) errList = []; For NHndl = 1: Try to remove the handle (handle.mahndal) if it is unreal (handles. Handle (NHDL)) (Handle Mehndal (NHDL)); Mistake errelist = [errlist err]; End end end if length (err8ist) == 1 error ([mfilename ': ErrorClosingUI'], 'Error turning UI:% s', errList.message); Otherwise length (errList) & gt; 1% should probably make some clever errors with error messages ([mfilename ': ErrorClosingUI'], 'Many errors occured UI occurred'); End    

No comments:

Post a Comment