简体   繁体   English

如何将C ++程序作为Simulink块运行?

[英]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.

相关问题 如何使用“构建模型”功能从Matlab simulink块生成c / c ++代码? - How can I generate c/c++ code from matlab simulink block using 'Build Model' function? 我可以在 Simulink model 中运行 C++ Qt 应用程序吗? - Can i run a C++ Qt Application in Simulink model? 如何从C ++程序运行另一个程序 - How do I run another program from a C++ program 如何停止 C++ 程序? - How can I stop C++ program? 当我关闭程序并在C ++中再次运行它时,如何停止记录覆盖 - How can I stop my records from overwriting when i close the program and run it again in c++ 有没有办法通过 MySQL 查询运行 c++ 程序? - Is there a way I can run a c++ program through MySQL query? 如何直接在Android设备上以可执行文件的形式运行简单的c ++程序? - How can I run a simple c++ program on android device directly as an executable? 如何在c ++程序运行时隐藏控制台? - How I can hide the console during c++ program run-time? How can I run c++ web program in Windows using xampp Apache server? - How can I run c++ web program in Windows using xampp Apache server? 如何创建单个 vim 正则表达式 map 来编译和运行 c++ 程序在 Z0F4137ED1502B58545D6083AA2 中 - How can I Create single vim regular expression map to compile and run c++ program in windows
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM