Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Persistent error dialog in Matlab

I was wondering if there is a way to prevent an error dialog (errordlg) to appear when an existing error dialog hasn't been attended yet. I'm developing a GUI in matlab and I can easily make 50 error dialogs to appear and collapse my task manager as it is shown in the picture.

A lot of error dialogs

On the other hand, I have seen warning or error dialogs that don't let the user to operate the GUI until he attends them. Is there anyway to do that?

Thanks in advance! Charlie

like image 776
Charlie Avatar asked Mar 25 '26 23:03

Charlie


2 Answers

If the same callback is creating the error dialog, you can prevent callback re-entrancy by inspecting dbstack for multiple calls to the responsible callback. See the isMultipleCall function on this blog.

There is no sense to plagiarizing Yair Altman's function here, but the usage would involve putting the following line at the top of the callback that creates the errordialog:

if isMultipleCall();  return;  end

Then that callback cannot run again until you have addressed the errordialog, allowing the first call to terminate.

However, you can create your error dialog with the 'WindowStyle' called 'modal', which will prevent interaction with any other MATLAB window until the dialog is closed.

like image 178
chappjc Avatar answered Mar 28 '26 12:03

chappjc


errordlg has a third argument createmode. One possible value is 'replace' for which all previously open error dialogs with the same title are closed. This can be useful in your case if the 50 or so error dialogs are the same.

like image 34
s.bandara Avatar answered Mar 28 '26 13:03

s.bandara



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!