Need to test the validity of an application handle

Technical Source
2 min readMar 29, 2023

--

I call a data application from my main application and store the data app handle in a main app local variable.. The data app has a Close button which first sets the handle to [] (by using the callingApp handle and then deletes itself. This works fine, no problem.

The probem occurs when the user closes the data app window using the “X” in the upper r/h corner. This action does execute the delete callback, but I’m unable to add code to this callback to also empty the data app handle. I’d prefer the user not use the “X”, but it’s impossible to prevent him from doing so inadvertently.

Isvalid would do the trick, but it’s not available in 2022b. I could upgrade to 2023a, but I’d prefer not doing so at this time. An solutions?

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

> I’d prefer the user not use the “X”, but it’s impossible to prevent him from doing so inadvertently.

You can set the [x] close button to be unresponsive to clicks.

uif = uifigure('CloseRequestFcn',[])

Or display an alert box to inform the user to use the app’s close button

uif = uifigure('CloseRequestFcn',@(f,~)uialert(f,'Use the app''s close button','No-Can-Do'))

To close these figures

close(uif,'force')
% or
delete(uif)

or, if you lose the handle, this deletes all figures

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source
Technical Source

Written by Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.

No responses yet