Use S-Function Block instead of S-Function Builder for handwritten Code

8 ビュー (過去 30 日間)
Pascal Dröge
Pascal Dröge 2016 年 3 月 2 日
回答済み: Wenjie Shi 2018 年 1 月 11 日
I´m using MatLab Simulink to control a DC Motor with PWM on a Raspberry Pi. As examples i used 'raspberrypi-driver-blocks'. The Problem now is, that I need the mdlterminate and mdlstart functions, that aren't supported in the S-Function Builder Dialog. I therefore edited the generated files (.c-File, .c-wrapper-File and .tlc-File) for my needs. I already read a post, which i can't find now, that recommended replacing the files built by the builder with my handwritten code to get the custom functions running. This unexpectedly works, but i want to use a 'normal S-Function-Block' instead of the Builder Block in my model, because it is a pain editing and expanding my functions. Also the non-permanent mask of a SF-Builder Block is unpleasantly.
I hope the problem is understandable, i´m a non-native speaker of english.

回答 (2 件)

Mark McBroom
Mark McBroom 2016 年 3 月 20 日
1. recompile the mexfile with the "mex" command 2. Put sfunction block in your model configure it to reference your new mex file 3. Optionally mask the sfunction block with parameters required for your sfunction

Wenjie Shi
Wenjie Shi 2018 年 1 月 11 日

カテゴリ

Help Center および File ExchangeSimulink Coder についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by