How to replace a Constant block with a From Workspace block programatically?

How to replace a Constant block with a From Workspace block programatically? I have tried with replace_block but shows an error InvalidBlockHandle . If to replace the same constant block with inport its working fine .

 Accepted Answer

Try this... e.g. Model is open, block is named as 'Constant'...
replace_block(bdroot,'Name','Constant', 'built-in/FromWorkspace')

1 Comment

Thank you very much . I was trying with replace_block(bdroot,'Name','Constant', 'built-in/From Workspace');

Sign in to comment.

More Answers (0)

Categories

Find more on Modeling in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!