MATLAB: How to replace a Constant block with a From Workspace block programatically

from workspace block programaticallyMATLAB

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 .

Best Answer

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