Generate code from .rtw file

Hello,
I have file .rtw from model. Is possible to generate code from them or I must generate code only from model (Build Model)?
Thanks,
Vit

回答 (1 件)

Abhilash Padma
Abhilash Padma 2019 年 7 月 29 日

0 投票

Hi,
Yes, it is possible to generate code from .rtw file. You can use the rtwbuild() function and pass the name of the rtw file as an argument to this function to generate code.

5 件のコメント

Vit Valek
Vit Valek 2019 年 7 月 30 日
I try use rtwbuild(), but does not work. It need file with extension ".mdl" or ".xls".
>> rtwbuild('model.rtw')
Error using load_system (line 21)
The file name 'model.rtw' is invalid because it does not have the extension ".mdl" or ".slx".
Error in load_model
Error in slbuild_private
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in slbuild (line 78)
sl('slbuild_private', mdl, target, varargin{2:end});
Error in rtwbuild (line 235)
slbuild(sys, 'StandaloneRTWTarget', ...
Can you help me please?
Abhilash Padma
Abhilash Padma 2019 年 7 月 30 日
In my case it is working using rtwbuild(). Do not put the extension '.rtw' while passing it to the function.Try:
rtwbuild('model');
Let me know which version of simulink you are using.
Vit Valek
Vit Valek 2019 年 7 月 30 日
I am using R2018a. This command woks:
rtwbuild('model');
It generates code from model, but not from .rtw file. And I need generate from .rtw. Are you sure whether is possible generate code from .rtw file?
Nick Sarnie
Nick Sarnie 2019 年 8 月 10 日
編集済み: Nick Sarnie 2019 年 8 月 15 日
Hi Vit,
The RTW file is not sufficient for complete code generation. The RTW file contains information about the model's properties, settings, and modeling style, but does not contain any algorithm or block code. The TLC compiler combines information in the RTW file with the algorithm code in TLC files to produce the final code.
Thanks,
Nick
Vit Valek
Vit Valek 2019 年 8 月 12 日
Hi Nick,
Thank you for your answer!
Vit

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

カテゴリ

ヘルプ センター および File ExchangeSimulink Coder についてさらに検索

製品

リリース

R2018a

質問済み:

2019 年 7 月 25 日

編集済み:

2019 年 8 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by