You receive this error message using QUESTDLG because UIWAIT expects its first input argument to be a function handle (which is the case for MSGBOX, but not for QUESTDLG).
The attached file, 'My_questdlg.m' closely reproduces the operation of the question dialog box, and can be made to work with UIWAIT. You would have to modify it slightly to have it return an output string, if this is what you want.
In order to run this program, download the attached files into your working directory. Then run the following command at the MATLAB command prompt:
My_questdlg('Are you sure you want to stop Realtime?','Close Request Function','Yes','No')
This will open up a GUI similar to your question dialog box. If there is no user input, the figure is deleted and control is returned to the main program after an interval of 5 seconds.
Best Answer