[Solved] MATLAB function file when compiled into a standalone application does not print output on the command prompt
17 ビュー (過去 30 日間)
古いコメントを表示
I have a matlab function file - 'MATLABxx.m'. It works as expected and prints a desired output text in the command prompt whenever executed.
I have enabled 'diary' in it which captures the text from command prompt.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1326055/image.png)
But now when I have compiled it into a standalone application - 'MATLABxx.exe', it does not print the desired output in command prompt. Although the same is captured in diary!![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1326060/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1326060/image.png)
I have compiled it using the -'Application Compiler' option.
Can anyone help me out here? I need the desired output to be printed in the command prompt, as another Application (which I cannot touch/change) reads that output for further processing!
Have I missed adding a flag during compilation which is causing this?
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
[Solved]
Found another thread with similar issue - Problem with displaying output of executable - MATLAB Answers - MATLAB Central (mathworks.com)
This suggests to uncheck an option in 'Additional runtime Settings' in the 'Application Compiler'. And it works for Windows!!
This issue does not happen on Linux.
2 件のコメント
Fangjun Jiang
2023 年 3 月 16 日
How do you "print" text to MATLAB Command line in your .m file? Use disp(), fprint(), or a command without ";" at the end?
回答 (1 件)
Hitesh
2025 年 2 月 3 日 8:23
Hi Atin,
I too encountered the similar issue where the output was not displaying in the command window. You were running the ".exe" file located in the "for_redistribution_files_only" directory. You need to run the ".exe" file generated in the same directory as the ".m" files. Open this directory in the command window and run the ".exe" file from there. You will get the output on the command window.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1825007/image.jpeg)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Entering Commands についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!