Why do I get an error when I run a block replacement script for my model in Simulink Design Verifier 1.4 (R2009a)?

1 view (last 30 days)
I have a model where I am trying to replace all the unit delay blocks with memory blocks. I have written a block replacement script and a custom rule for the Simulink Design Verifier.
When I run this script I get the following error:
??? Error using ==> BlkReplacer.executeReplacements at 104
Cannot apply block replacements to model 'expt5' due to unsaved changes
Error in ==> sldvblockreplacement at 38
[status, modelH, msg] = blockRepObj.executeReplacements(obj,opts,showUI);
Error in ==> replace_mem at 11
[status, newmodelH] = sldvblockreplacement(system_name, options);
I am wondering how to resolve this issue. I have saved my model before I run the script.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
As the error message suggest the issue is that the model has unsaved changes. It is the replacement script that makes changes to the model.
Following is an excerpt from the replacement script.
options = sldvoptions(system_name);
options.BlockReplacement = 'on';
options.BlockReplacementRulesList = '<FactoryDefaultRules>, customrule_integrator_memory';
newmodelname = ['new' system_name];
[status, newmodelH] = sldvblockreplacement(system_name, options);
The 'options' structure is the one which shows up in the Configuration Parameters. When the second line is executed the script is making change to the configuration parameters. Therefore the model has unsaved changes.
Adding the following line of code before modifying the options structure resolves the issue:
options = options.deepCopy;
The above command makes a local copy of the options structure and does not make any changes to the model.

More Answers (0)

Categories

Find more on Interactive Model Editing in Help Center and File Exchange

Tags

No tags entered yet.

Products


Release

R2009a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!