[英]How can I run a C++ program as a Simulink block?
I programmed a UDP socket in C++ in order to receive a string from another program. 我用C ++编写了一个UDP套接字,以便从另一个程序接收字符串。 Now I need to use the data in a Simulink project. 现在,我需要在Simulink项目中使用数据。 I tried the UDP-receiver block in Simulink but I can't separate the data string, so I prefer to try running my UDP socket (in C++) as a block in Simulink. 我在Simulink中尝试了UDP接收器块,但无法分离数据字符串,因此我更喜欢尝试在Simulink中将UDP套接字(在C ++中)作为一个块运行。 I know that I should use a S-function but I don't know how or if there is another possibility. 我知道我应该使用S函数,但我不知道如何或是否还有其他可能性。
There is a feature called the Legacy Code Tool
which should do what you are after. 有一个称为“ Legacy Code Tool
的功能,该功能应可满足您的需求。 Essentially, it simplifies the process of defining custom Simulink S-function blocks when using existing C
/ C++
. 从本质上讲,它简化了使用现有C
/ C++
时定义自定义Simulink S功能块的过程。 I seem to remember that there are a few limitations when using C++
instead of C
but I don't think they are too significant... 我似乎记得使用C++
而不是C
时有一些限制,但我认为它们没有太大意义。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.