필터 지우기
필터 지우기

Communicate an error with the APP

조회 수: 1 (최근 30일)
Vasista Adupa
Vasista Adupa 2020년 8월 15일
답변: Walter Roberson 2020년 8월 15일
I have created an app in app designer. It works well, but the only problem is stopping the app when an error occur. I have to run a function file from the app, so when there is an error in that function file, the information should be communicated with the app, so that the app can be stopped. Is there any way to do it.
Thank you.
  댓글 수: 3
Vasista Adupa
Vasista Adupa 2020년 8월 15일
Thank you that works great. But I didn't get "have the function file error()". Please elaborate. For now I am using this.
Try
Functionfilecalling
Catch
Error('error occured')
end
Vasista Adupa
Vasista Adupa 2020년 8월 15일
Got it. Thank you.
Try
Functionfilecalling
Catch ME
rethrow(ME);
end

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2020년 8월 15일
try
Functionfilecalling
catch ME
rethrow(ME);
end
function Functionfilecalling
%example of something that generates an error
[status, attr] = fileattrib(pwd);
if ~status || attrib.UserWrite ~= 1
error('You cannot write to the current directory');
end
%no error, do something
fprintf('The rain in Spain is mainly in the plains.\n')
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by