Problem with displaying output of executable

19 ビュー (過去 30 日間)
Veronika
Veronika 2012 年 3 月 27 日
コメント済み: derrick burton 2023 年 12 月 14 日
I have a function which produces a string output:
out = myfunction(arg1, arg2)
The last line of the function is disp(out).
I used the deploytool to produce an executable (for Windows). However, when I call myfunction arg1 arg2 in cmd, I do not see any output.
I know the function is working correctly because if I replace disp by writing to a file, that works.
Also what is strange is that if I replace disp() by error(), I do see the error message.
Has anybody had this problem?

採用された回答

Kevin Holst
Kevin Holst 2012 年 3 月 27 日
If you're compiling it as a 'Windows Standalone Application' switch that to a 'Console Standalone Application'.

その他の回答 (3 件)

Antti
Antti 2018 年 1 月 26 日
Note that in R2017b (and possibly beyond) on Windows 10, no output is printed on the Windows command prompt even if you launch the executable from command prompt, unless you uncheck "Do not display the Windows command shell (console) for execution" under "Additional runtime settings" in the Application Compiler tool of MATLAB Compiler.
  5 件のコメント
ratnesh pandey
ratnesh pandey 2020 年 7 月 29 日
@Antti Yes, that was the case with me. Thanks. I am using R2017b and only after unchecking the checkbox I am getting the result on console.
derrick burton
derrick burton 2023 年 12 月 14 日
Thanks !!

サインインしてコメントする。


Image Analyst
Image Analyst 2012 年 3 月 27 日
Did you use the -e option to suppress the console window? If so there is no place for things like disp() and fprintf(1,...) to output to. Otherwise they should show up in the console window (the black box window).

Veronika
Veronika 2012 年 3 月 27 日
Kevin, your solution helped, thanks! I thought the problem was elsewhere and did not consider the type of compiling.
Image Analyst, I used the deploytool with the default option (probably without supressing, because it works now).
Thanks for the quick replies!

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by