How to include libraries for sfunction?

14 Ansichten (letzte 30 Tage)
Mario Frischmann
Mario Frischmann am 4 Sep. 2017
Kommentiert: Mario Frischmann am 20 Nov. 2017
Hello,
I need to get run a C sfunction some libraries like stdio.h and stdlib.h.
I tried to copy that libraries in the current path. But that libraries call other libraries and I get errors compilling (mex) the C sfunction.
How can I include all libraries which i need? I am a Beginner Thanks a lot

Antworten (1)

Nick Sarnie
Nick Sarnie am 7 Sep. 2017
Hi Mario,
The easiest way to include custom libraries in C S-Functions is to use the S-Function Builder block, which is located in the Library Browser under Simulink>User-Defined Functions. On the Libraries tab of the S-Function Builder UI, you can specify the custom headers and library files to include.
  3 Kommentare
Nick Sarnie
Nick Sarnie am 7 Sep. 2017
Bearbeitet: Nick Sarnie am 7 Sep. 2017
Hi Mario,
You shouldn't need to copy all of the system library headers like stdio.h to the local directory. I recommend using the angle brackets, < and >, to specify system library headers. You can use
#include <stdio.h>
in the "Includes" section, which will search the standard system header locations. If it is a custom library header, you can store it in the current directory and use quotes instead:
#include "myHeader.h"
For custom library files, you can specify the location to the files in the "Library/Object/Source Files" section.
Mario Frischmann
Mario Frischmann am 20 Nov. 2017
Hi Nick,
thank you for your help. It worked perfectly and I unterstand it now.
Can I also include libraries which are stored on the Raspberry Pi 3?
Like for example: #include "/home/pi/wiringPi/wiringPi/wiringPi.c" ??
Thanks in advance

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Block and Blockset Authoring finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by