How to return error code from compiled exe, without throwing up dialogue box?

2 ビュー (過去 30 日間)
Bogdan Dzyubak
Bogdan Dzyubak 2021 年 8 月 5 日
コメント済み: Bogdan Dzyubak 2021 年 8 月 6 日
Hi, Matlab community
I need to receive an error code from a Matlab compiled exe. I read that the way to do this is just by throwing an error. However, this also throws up a dialogue box which I do not want to happen:
function error_code = my_function()
class % This results in error
On the other hand, just returning a value is not interpreted as an error code by the system:
function error_code = my_function()
try
class
error_code = 0;
catch
error_code = 1;
end

採用された回答

Jan
Jan 2021 年 8 月 6 日
編集済み: Jan 2021 年 8 月 6 日
Does this answer still work:
function my_function()
try
class
error_code = 0;
catch
error_code = 1;
end
exit(error_code)
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeWhos についてさらに検索

製品


リリース

R2014b

Community Treasure Hunt

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

Start Hunting!

Translated by