Hello,
The PLECS C-Script block can be used to link to C library files or you can manually port the code from your embedded files into the appropriate functions, but in both cases, this may be cumbersome. You might consider to generate a DLL block that represents your logic, or the State Machine block, which is a bit more visually intuitive to work with than the C-Script block.
But looking at your .m file, you might just want to include this code as is (or with slight modifications) in the initialization commands of a subsystem. Out of curiosity, why are you trying to port it from MATLAB code to C code?
Regards,
Kris