How to get all block parameters from a simulink block?
7 views (last 30 days)
Show older comments
Jack Kershaw on 7 Oct 2022
Answered: Fangjun Jiang on 7 Oct 2022
I am trying to convert a model cointainign TargetLink blocks to there corresponding simulink blocks. Currently I am using:
param = get_param(targetLinkBlock, 'Param');
Then replacing and setting the paramaters of the new block using:
simulinkBlock = replace_block(model, 'Name', block_name, type);
set_param(simulinkBlock, 'Param', param);
Although this does work, it seems a very tedious way to do this, especially as some blocks such as lookup tables have well over 10 parameters.
Is there a better way to do this, by getting and setting all parameters in a single command, or just a simpler way to unlink/mask the target link blocks?
Fangjun Jiang on 7 Oct 2022
Use the function that is provided by TargetLink. I used it before but can't remember the name, something like tl_clear_system()?
TargetLink provides the capability to do Simulink <--> TargetLink conversion both ways, and API too.
Find more on Programmatic Model Editing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!