Problem with displaying output of executable
显示 更早的评论
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?
采纳的回答
更多回答(3 个)
Antti
2018-1-26
7 个投票
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 个评论
Image Analyst
2018-1-26
I guess that applies for leaving the semicolon off, but is that also the case if you explicitly call fprintf() to print something to the command window (consolw window)? Like if I do
fprintf('This goes to the command window.\n');
where, if anywhere, will that show up?
Ian Sullivan
2018-8-15
编辑:Ian Sullivan
2018-8-15
Could you confirm that this is this new behaviour introduced in R2017b please? I am getting console output when using R2017a.
Antti
2018-8-16
If you leave the checkbox I mentioned above checked, then no output is shown on the command window, not even if you explicitly call fprintf. Everything is suppressed. But if you uncheck the checkbox, then leaving the semicolon off, and calling printing functions will output. This behavior is introduced in R2017b.
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
2023-12-14
Thanks !!
Image Analyst
2012-3-27
0 个投票
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).
类别
在 帮助中心 和 File Exchange 中查找有关 Standalone Applications 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!