Replacing Blocks in Simulink but keep their value
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I'm runnign the following script for a Simulink model called Replacement_Blocks. I am attempting to replace the constant block found in the generic Simulink library with a certified primitive library that is needed for aerospace development applications.
RepNames = replace_block('Replacement_Blocks','Constant','do178Lib/Simulink/Sources/Constant');
When I run this script the values of the replacement blocks(ones originally with white background) are overwritten. Is there a way to keep the value of the original constant blocks while replacing it with the primitive library equivalent?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/797264/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/797269/image.jpeg)
0 comentarios
Respuestas (1)
Paul
el 11 de Nov. de 2021
You can use :
val = get_param(blk,'Value')
to get the value of the Contant block(s) to be replaced.
Then replace the block(s).
Then use
set_param(RepNames,?,val) % fill in ? with the correct parmeter for the new block
Should be able to loop over all the block replacement pairs.
0 comentarios
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!