from Replace Simulink Scope/Display Blocks with Terminators by Stuart Bowman
Cleans Simulink models of all Scope and Display blocks by replacing them with Terminator blocks.

smcTest.m
% Show how to programmatically clean up a Simulink Model

%% Instantiate the cleaner object
smc = simulinkModelCleaner('fallingBallExample');

%% Just for fun, see how many Scopes exist right now.
[scopesBefore,cntBefore] = smc.findBlockByType('Scope');

%% Replace all Scopes & Displays with Terminators
smc.doCleanUp;

%% Now, let's check the number of Scopes. Should be 0.
[scopesAfter,cntAfter] = smc.findBlockByType('Scope');

%% Now, let's revert back to Scopes & Displays.
smc.undoCleanUp;

%% Now, let check the number of Scopes again.
[scopesAfter2,cntAfter2] = smc.findBlockByType('Scope');

Contact us at files@mathworks.com