Embeded existing C code in a Simulink model

I will appreciate if someone can show me some examples on very simple Simulink model which also embed the C code.

답변 (6개)

William
William 2013년 12월 19일

0 개 추천

I consider myself a new user of Matlab/Simulink. I looked at some examples of "User-Defined Functions" but they were a little confusing to me.
Kaustubha Govind
Kaustubha Govind 2013년 12월 19일

0 개 추천

There is an automated tool called the Legacy Code Tool which will generate a block that will interface with your C code.
William
William 2013년 12월 19일

0 개 추천

Thanks. I am playing with example in the manual right now.
William
William 2013년 12월 30일

0 개 추천

Is there any tool in Simulink libray you can embed the C code w/o using Matlab?
William
William 2014년 1월 9일

0 개 추천

The example for Legacy Code tool only applied to one input & one output from the C code. Can we specify multiple inputs & outputs if my C code generate multiple outputs? Can I put mySF.SFunctionName = 'my_sfun_myccode'; mySF.OtuputFcnSpec = 'double y1 = 'myccode(double u1); mySF.OtuputFcnSpec = 'double y2 = 'myccode(double u2); etc.
Thanks.
William
William 2014년 1월 9일

0 개 추천

One more question: The C code example in the manual has a function ("doubleIt") & returns one output. The C code I want to implement only has a for loop with multiple outputs. Do I have to create a function to accomodate my for loop?
Thanks in advance

카테고리

도움말 센터File Exchange에서 Interactive Model Editing에 대해 자세히 알아보기

제품

질문:

2013년 12월 17일

답변:

2014년 1월 9일

Community Treasure Hunt

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

Start Hunting!

Translated by