Disp function with matlab coder

5 ビュー (過去 30 日間)
Chuck37
Chuck37 2016 年 12 月 1 日
コメント済み: Benjamin Thompson 2024 年 6 月 15 日
I'm experimenting with a simple hello world function to see how the coder works.
disp('Hello world')
The mex version works, but when I make a standalone executable there is no output. In fact, the generated code for the function itself is completely empty ({}), like the disp() was purposely skipped over. Is this the expected behavior, or is there some setting I can change?
EDIT: I just tried fprintf(1,'Hello world'), and the converted code contains "cfprintf()". So still, purposely suppressing output? BTW, this is on Linux/2016b.
  1 件のコメント
Benjamin Thompson
Benjamin Thompson 2024 年 6 月 15 日
Is there a recommended workaround for the problem of wanting to generate console output from an M file that is generated to C/C++ code?

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

回答 (1 件)

Vishal Neelagiri
Vishal Neelagiri 2016 年 12 月 5 日
The 'disp' function is not supported to generate C/C++ code from MATLAB code. You can refer to the following documentation link for a list of functions that support code generation:
https://www.mathworks.com/help/rtw/ug/create-a-protected-model-using-the-model-block-context-menu.html

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by