Search code examples
matlabraspberry-pisimulinks-function

S-function not found by Simulink unless rebuild


I am currently using Matlab Simulink with a Raspberry Pi. I have been using the S-Function Builder block to generate an S-Function that I am using with the S-Function Block. However, I always need to keep a copy of the S-Function builder that I need to build at the first start, as Simulink otherwise tells me :

"Error in S-function 'read_accelerometer/S-Function': S-Function 'sfun_read_adxl345' does not exist"

I am keeping the .c and the wrapper.c file, as well as the mexw64 and the tlc files. But that does not matter - I still have to rebuild the S-Function using the Builder block every time I reload my model.

How to circumvent this issue?


Solution

  • Ok, this is kinda sad that I am answering my own question ... I had a startup script that messed with the mexw64. So, always keep the mexw64 file, even if it is not needed. (recompilation on Raspberry Pi) Also, specify the generated wrapper function as a module in the S-Fun block.