When compiling, I put my H-files and C-files in different directories, as well as my .DLLs in a separate directory. After a successful compilation of my S-function, I run my model and it stops execution at the S-function and gives me the following error:
Error while obtaining sizes from MEX S-function 'S_func' in block 'Block1/S_func.' MATLAB error message: Invalid MEX-file.
It runs without error every time thereafter. This error occurs everytime on the first run when I just open the model, recompile the S-function, or update the diagram (Ctrl+D).
Also, I do not get the error if I put all of my files into a single directory.
Best Answer