MATLAB: How to lock a block in Simulink

simulink

I wrote my own library, with one S-Function Block in Simulink. I want that it is possible to insert the block once in a Simulink Model, but not a second time (in the same model). I want that the my block is unique in the model. I need the block for some settings. Is there a chance to do that?

Best Answer

I suppose there is no way to present inserting the block a second time, but you can verify if more than one block of this type exists right before running the model. You would need to apply MATLAB code with e.g. the "find_system" command as a model callback .