MATLAB: How to automatically migrate obsolete blocks in Communications Blockset to their newer versions in Simulink 6.4 (R2006a)

badlinkobsoletesimulink

I want to migrate obsolete blocks in Communications Blockset to their newer versions in Simulink 6.4 (R2006a).

Best Answer

This enhancement has been incorporated in Release 2007b (R2007b). For previous product releases, read below for any possible workarounds:
The SLUPDATE utility does not migrate obsolete blocks from Communications Blockset in Simulink 6.4. The obsolete blocks have been removed in Simulink 6.5 (R2006b). Therefore the user needs to migrate the obsolete blocks in that blockset before upgrading to R2006b. It is possible to manually migrate the obsolete blocks.
If there are a lot of obsolete blocks, it is possible to replace blocks of the same type automatically using a MATLAB script. Note that both the obsolete and the current blocksets need to be available in order for the migration process to work.
It is important to backup the models before the migration is attempted since the changes cannot be undone once the migrated model has been saved. Moreover, when working with large model libraries, it is strongly recommended to migrate a small subset library and then proceed to migrate the whole model library once it is verified that the migrated models run properly.
The following code migrates the obsolete block "Uniform noise generator" to its newer version in a model called ObsoleteModel.
bdclose all % Close all open models
commnoisgen2 % Open current block library
a = find_system('commnoisgen2', 'CaseSensitive', 'off', 'RegExp', 'on', 'Name', 'Uniform*');
ObsoleteModel % Open the model containing obsolete blocks
b = find_system('ObsoleteModel', 'BlockType', 'SubSystem')
% Read selected parameters from the obsolete block
low = get_param(b,'low')
up = get_param(b,'up')
seed = get_param(b,'seed')
ts = get_param(b,'ts')
% Replace the blocks
disp('Select the block(s) that you wish to replace');
rep = replace_block('ObsoleteModel', 'SubSystem', a{1})
% Set parameters for replaced blocks
for ii = 1:length(rep)
set_param(rep{ii}, 'low', low{ii}, 'up', up{ii}, 'seed', seed{ii}, 'Ts', ts{ii}, 'frameBased', 'off');
end
disp('Recall to verify and save your model');