reuse C code in simulink
조회 수: 2 (최근 30일)
이전 댓글 표시
Hello every one,
is is possible that i call a c program from a stateflow chart, then I copy this chart, still in this same model, and execute both with out any conflict?
for example a C program like this
int var; // var is global
int myfunction(int n)
{
var = var + n;
return var;
}
i mean, treat them like two different entities and won't mess up with global variable.
답변 (2개)
Jason Moore
2015년 4월 3일
Yes, you can create s functions of your legacy C code that can be used in your simulink model. To do this the easiest way is to use the legacy code tool. This tool will allow you to create an s function compile it and create a block that can be used in your model. Here is the link to the documentation.
TAB
2015년 4월 6일
Also you can integrate your C code directly in Stateflow chart for Simulation.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!