how to close error dialog
古いコメントを表示
after run some script, i got so many error dialog, how to quickly close them at one time.
採用された回答
その他の回答 (1 件)
Image Analyst
2023 年 8 月 29 日
Fix the code or data so that the errors never occur. Or else just call "return" instead of
uiwait(errordlg("You made a mistake!"))
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
7 件のコメント
wenchao zhang
2023 年 8 月 29 日
Image Analyst
2023 年 8 月 29 日
I understood you. I'm just saying that since you have error messages, you must have errors. So avoid the messages by avoiding the errors.
If you can't avoid the errors, or don't want to, then you can replace the error message with questdlg and if the user clicks a button, then exit the program entirely so that the other messages don't appear.
Alternatively you can use java robot. Adapt the code below to have it click on the location of the OK buttons on the error messages.
% Demo to use java robot to push buttons on a web page
% WARNING: Make sure that the coordinates in this file won't click on anything dangerous.
% You should verify the coordinates before running this.
clc;
import java.awt.Robot
import java.awt.event.*
mouse = Robot;
% Press a push button on the page.
% Move to pixel (330, 455) on the computer screen.
mouse.mouseMove(330, 455); % First message.
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
pause(1); % Give time for page to refresh.
% To perform right click (BUTTON3) and get the menu(works fine)
mouse.mouseMove(270, 505);
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
% Click next page button.
pause(2); % Give time for page to refresh.
mouse.mouseMove(940, 422); % Next page.
mouse.mousePress(InputEvent.BUTTON1_MASK);
mouse.mouseRelease(InputEvent.BUTTON1_MASK);
% Put mouse over MATLAB run button.
mouse.mouseMove(1520, 74);
fprintf('Done.\n');
wenchao zhang
2023 年 8 月 29 日
Image Analyst
2023 年 8 月 29 日
Yep, java robot will do that for you as long as you can put it into a script that can be run after all the error messages have finished appearing.
wenchao zhang
2023 年 8 月 29 日
Image Analyst
2023 年 8 月 29 日
Yes, I know. And I also know that obviously you never tried my solution. However I think Adam may have a better answer below. Of course both of our solutions mean running code, either as a script (mine) or in the command window (Adam's).
wenchao zhang
2023 年 8 月 29 日
カテゴリ
ヘルプ センター および File Exchange で Aerospace Applications についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!