There is not a direct way to have a MATLAB Function block participate in Simulink simulation while not generating any HDL code for it. There are a couple of indirect ways, however.
One way is to reorganize your design so that the MATLAB Function block is not inside the subsystem you are generating HDL code for. This will have the side effect of changing the I/O interface to your generated code. This is probably the best approach; if you do not want code generated for a particular block, then that block should probably not be part of the design you generate code for.
A second way is to wrap the MATLAB Function block inside an additional subsystem. This subsystem can be marked as having a Black Box implementation. What this means is that no HDL code will be generated for the subsystem or its contents. HDL Coder will generate a module instance with the interface of the subsystem, but no code for the contents. This is intended to allow the user to insert their own handwritten HDL code into a design.
There is no way to pick and choose what MATLAB code in a function block gets HDL code generated for it.