replace_block and load_system
3 ビュー (過去 30 日間)
古いコメントを表示
I have 2 questions, first being:
1. Can replace_block replace blocks with custom made blocks? I'm having some trouble with that so I don't know if it's supported or not. Can you tell replace block to only replace blocks on the top level or in a subsystem?
2. Can you run load_system and tell it not to save the changes you made? I want to use replace_block, run my model and exit leaving the model in its original state.
0 件のコメント
採用された回答
Kaustubha Govind
2012 年 6 月 8 日
Yes, you should be able to replace blocks using replace_block with custom blocks as well. You will need to specify the full path of the library for custom blocks. Also, you might need to make sure that the custom library is loaded using load_library.
To have replace_block replace only inside a subsystem, you need to specify the path of the subsystem as the first argument (instead of the name of the top-level model).
To have it replace only blocks in the top level, use the 'SearchDepth' argument as follows:
>> replace_block('vdp', 'SearchDepth', 1, 'BlockType', 'Gain', 'Integrator')
If you are loading/opening a model, you also need to close it using close_system. You can tell close_system to not save changes by using the saveflag argument:
>> close_system('vdp', 0)
1 件のコメント
Kaustubha Govind
2012 年 6 月 8 日
No, you just need to make sure that model is on the MATLAB path. Then, run load_system('External_In_Out_Blocks'). Then, if that library has a block with the name (let's say) 'My Custom Block', the path you need to use for the new_blk argument is 'External_In_Out_Blocks/My Custom Block'.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Programmatic Model Editing についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!