Self-modifying block libray
1 次查看(过去 30 天)
显示 更早的评论
This is my situation. I’m creating a masked subsystem that includes basically Simulink blocks, SimPowerSystems blocks and Matlab functions. According to one masked parameter, I should add or delete blocks to the main structure, so I’m using the instruction Simulink.SubSystem.deleteContents(blk) to delete the whole subsystem, and create it again with the code I write in the Initialization Pane of the mask (the structure could be huge so i think it’s easier to do it in that way). My problem comes when I try to connect the blocks using add_line. Everything works fine if I change the parameter in the unlocked library (I get the number of blocks according to this parameter and they connect each other fine), but when I add my block to a new model, and I change this parameter, i get something like : ‘Initialization commands cannot be evaluated. –> The Destination port already has a line connection”. But if I comment the code about add_line, everything works perfect, obviously without the line connections, so it seems the problem is the add_line instruction. Any idea about where could be the problem? Is there some limitation about which changes could you do in a self-modifying block from a library? Thanks in advance PD: I've already check "Allow library block to modify ist contents"
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Subsystems 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!