S-Function containing C-code file

2 vues (au cours des 30 derniers jours)
David
David le 12 Mar 2014
Hey guys,
I have a question concerning the s-functions, because i have a problem with including a .c file as s-function. I already included .m files without any problems. I took the example "timestwo". I copied the timestwo.c and renamed it to timestwo1.c (also the define function-name). I used the mex command to compile the timestwo1.c which created me a timestwo1.obj in my workspace. I renamed the s-function in the timestwo-simulink example to timestwo1 and tried to run it. But it´s not working. I get the error: Error in S-function 'untitled1/S-Function': S-Function 'timestwo1' does not exist When I try to push the edit button in the s-function, it opens the timestwo1.c file, so it has the connection the the file. Also the model and the file are in the same workspace. Does anyone know an answer to this problem?
Thank You in advance

Réponses (1)

Kaustubha Govind
Kaustubha Govind le 13 Mar 2014
Did you also re-name the S_FUNCTION_NAME macro in the C-file?
#define S_FUNCTION_NAME timestwo1
Also, note that Simulink is looking for a file with a MEX-extension (eg. mexw64, mexa64, etc.), not an .obj file.

Catégories

En savoir plus sur Block and Blockset Authoring dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by