View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Simulink Model String Replacement

5.0 | 1 rating Rate this file 4 Downloads (last 30 days) File Size: 2.14 KB File ID: #26424 Version:

Simulink Model String Replacement



20 Jan 2010 (Updated )

replace a string in Simulink object names with another

| Watch this File

File Information

mdl_strrep is a utility to identify blocks and other Simulink components that contain a particular string in their name.
MDL_STRREP(OBJECT,S1,S2) replaces all occurrences of the string S1 in the name of a Simulink object and its children with the string S2. This enables the user to remove undesired characters in bulk or replace phrases when the model is used in a different context.

MDL_STRREP(OBJECTS,S1,S2) replaces all occurrences of the string S1 in the name of all Simulink objects defined in a cell array. The function will not include any children of the objects defined. This enables the user to fully specify the objects they wish to manipulate.

mdl_strrep(bdroot,' ','_')
replaces spaces in all blocks of current model with an underscore

cr = sprintf('\n');
removes any carriage returns in current block's name and any of its components if it's a subsystem

myblocks = find_system(bdroot,'BlockType','Scope');
finds all Scopes in the model and replaces the phrase "Scope" with "Probe"

Required Products Simulink
MATLAB release MATLAB 7.9 (R2009b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (1)
01 May 2012 K E

K E (view profile)

Very useful. Should be built in. Good tool to make model comply with best practices, like no spaces in block names.

01 Sep 2016

Updated license

Contact us