How to get a one function result?
이전 댓글 표시
I have a main function called mainfun
function [out1,out2]=mainfun(input)
[out1]=fun1(input);
[out2]=fun2(input);
end
so my question is ,may be i am calling my mainfun,and I want to display the individual result from different sub function,but how to display if there is any error in one subfunction ?
like an example ,
if in my fun1 there is eroor then also i want to get the fun2 result .
채택된 답변
추가 답변 (1개)
David Hill
2022년 5월 6일
function [out1,out2]=mainfun(input)
out1=nan;out2=nan;
try [out1]=fun1(input);
end
try [out2]=fun2(input);
end
댓글 수: 2
Akash Pal
2022년 5월 9일
Walter Roberson
2022년 5월 9일
You should initialize any output variable that might otherwise not be assigned to because of errors.
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!