I have read that using an Matlab Function within a Simulink model can severely impact its performance. The recommendation is to use the MATLAB Function block instead of the Interpreted MATLAB Function block.
It's not clear to me how this applies when compiling the model into C for use on an xPC Target machine. Am I subject to some kind of penalty because of the M-script, or am I better off using normal Simulink blocks to solve the same problem?
There should not be any penalty because of use of MATLAB Function block. When compiling the model MATLAB Function block compiles its MATLAB code into C like other Simulink blocks.
I would pick based on the best way to model the problem. For example, if your algorithm needs too many control flow statements or loops it is easier to code it in MATLAB Function block. You can always do a mixture of both.