how to find unconnect goto block and from block in the simulink model use script
18 次查看(过去 30 天)
显示 更早的评论
hello, i want use the script to find out all the unconnected(or unmatched) goto/from block in the simulink model,which command can i use, i dont know which item of the block i can used to confirm that this block is unconnected. i try check the Goto source, but dont know how to get this item use certain command.
0 个评论
采纳的回答
Michael
2023-8-9
编辑:Michael
2023-8-9
I think you should find a matching of the "GotoTag" in Goto blocks and From blocks.
First find all your Goto and From blocks in the model
gotoBlocks = find_system(System, 'BlockType', 'Goto'); % return the names of all Goto blocks
fromBlocks = find_system(System, 'BlockType', 'From'); % return the names of all From blocks
Now you have to get all GotoTags parameter in gotoBlocks and fromBlocks cell array. (Example only works for one element of the cell array)
gotoTag = get_param(gotoBlocks{1}, 'GotoTag'); % get the GotoTag of the first Goto block
fromTag = get_param(fromBlocks{1}, 'GotoTag'); % get the GotoTag of the first From block
If there is a connection between a Goto block and a From block then each entry in the gotoTag - array have to match with an entry in the fromTag - array. If an entry in the gotoTag - array has no match with fromTag - array then this Goto block has no connection and if an entry in the fromTag - array has no match with gotoTag - array then this From Block has no connection.
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!