Simulink Coder, add external C++ libraries placed outside the working directory
13 ビュー (過去 30 日間)
古いコメントを表示
Following problem: I'm using Simulink Coder, an Arduino Due and a self developed expansion board to control multicopters. I've a Simulink model with all the device drivers (made with s-function builder) to interact with the sensors. Every sensor has an own c++ library which is included in the s-function. All the c++ and header files are currently in the working directory of matlab.
No I have so many device driver blocks, that I made a custom Simulink block library in order to share and use these blocks in multiple Simulink models. However, if I'm using the blocks from my Simulink library the compiler gives an error because it can't find the c++ and header files, as they are not in the current working directory but in the directory of the Simulink library. However the Simulink block library and all the external c++ libraries are included in the Matlab search path (set path).
So does anyone know how to include external c++ libraries when they are called from an s-function in a Simulink block library?
I already tried following steps:
-I tried to include the c++ and header files with following matlab command (doesn't work): set_param('SimulinkModelName','CustomSource',"LibraryName");
-Copy the c++ and header files to the directory of the c++ libraries of the Arduino Simulink support package (doesn't work).
-Copy all the c++ and header files into the directory of the current Simulink model (does work however I don't want to copy all the files every time a new simulink model is created) Does anyone had similar problems so far?
0 件のコメント
回答 (2 件)
Philipp Schaefer
2016 年 2 月 20 日
They include it with a S-function that has no input, and no output. Run renc2cpp('sfcn_include_name') after that. (Read explanation in simulink file for more information)
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Modeling についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!