필터 지우기
필터 지우기

question regarding code generation.

조회 수: 2 (최근 30일)
Prasad Babu
Prasad Babu 2011년 8월 16일
Hi,
I have a question regarding code generation.
I have a simulink model which consist of a single stateflow block( my entire logic was done in stateflow) and 5 input ports (passes some input values to the stateflow) and a outport.
currently am interacting with the model using a gui( done using qt). Now I want to send my project to my higher officials,who doesn't have a matlab installed by converting entire model into a standalone exe.
I tried generating a exe from mdl using rsim.tlc. But I’ve no idea how to make my application to receive inputs and give the corresponding output.
This is my first attempt of auto code-generation. Please advice me in this issue.
Thanks n advance...

채택된 답변

Kaustubha Govind
Kaustubha Govind 2011년 8월 16일
The rsim.tlc target allows rapid prototyping on a machine that has MATLAB/Simulink installed. Since you need to forward your model to someone who does not have the products, you need to generate standalone C code from your model and then call into that from your GUI.
I would recommend using Embedded Coder (formerly called Real-Time Workshop Embedded Coder) to generate a shared library from your model. See Creating and Using Host-Based Shared Libraries. This will generate an interface for your model such that inputs/outputs and parameters can be passed in from an external application.
  댓글 수: 2
Prasad Babu
Prasad Babu 2011년 8월 17일
Hai kaustubha.. I tried building using rsim.tlc, I have encountered the following error:
'cmd' is not recognized as an internal or external command,
operable program or batch file.
gmake: *** [../FIAT_radio_input_win32.dll] Error 1
### Real-Time Workshop build procedure for model: 'FIAT_radio_input' aborted due to an error.
Error using ==> genMakefileAndBuild at 1139.
Is this a known error?
Kaustubha Govind
Kaustubha Govind 2011년 8월 17일
But rsim.tlc is not the right file to use - you need ert_shrlib.tlc right?
In any case, you might still run into the same issue. cmd.exe is a Windows executable that typically resides in the Windows\System32 or WINNT\System32 directory. Could you confirm the location of cmd.exe and make sure that this directory is on the System PATH environment variable.
Basically, you should be able to open a system command prompt by executing this in MATLAB:
>> !cmd &
From Windows, go to Start->Run and type cmd - this should also open up the system shell.

댓글을 달려면 로그인하십시오.

추가 답변 (2개)

Muhammad shahbaz
Muhammad shahbaz 2011년 8월 16일
use matlab code generator 2.0 or higher where u can generate .exe files of ur matlab code which can be executed anywhere without matlab just like c language files.
  댓글 수: 2
KYAW KYAW
KYAW KYAW 2011년 11월 24일
Hi Muhammad,
Where can i get matlab code generator and I really appreciate your help.
Thanks
Kaustubha Govind
Kaustubha Govind 2011년 11월 25일
I think Muhammad meant to say MATLAB Coder. See the Contact Sales link on this page: http://www.mathworks.com/products/matlab-coder/?s_cid=global_nav

댓글을 달려면 로그인하십시오.


TAB
TAB 2011년 8월 17일
As your model contains only stateflow chart, you can generate a simle C-code using 'stateflow coder(Use custom target). It generates code with chart inputs and outputs as global variables. You can write a main program and interface the stateflow generated code with it very easily.

카테고리

Help CenterFile Exchange에서 Simulink Coder에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by