How order my own Simulink library in folders?
3 ビュー (過去 30 日間)
古いコメントを表示
I have already my library (.mdl) with several blocks and I need to order it. I have saw that I can make subsystems to see folders at "Simlink Library Browser".
My problem is that if I do it, the links are broken in models that I have done before the changes.
Any idea. Thanks in advance!
0 件のコメント
回答 (1 件)
Zack Peters
2013 年 11 月 8 日
Unfortunately, there is no easy way to do this. If you double click on the bad link in one of your models, you can see that its pointing to a specific path and that path had been modified by creating a subsystem.
You could create a script which will find all of the bad links in your model, find the name of the block that it was pointing at (libName/blockName), and then find the new block.
I created a very rough demo script which gets the job done on a simple test case that I create. Give it a try and see how it works:
myModel = % Name of your model
myLib = % Name of you library
x = find_system(myModel,'FindAll','on','type','block','BlockDescription','Unresolved library reference.');
for i = 1:numel(x)
source_block_path = get_param(x(i),'SourceBlock');
[~,source_block,~] = fileparts([source_block_path '.blah']);
lib_block_handle = find_system(myLib,'FindAll','on','type','block','Name',source_block);
set_param(x(i),'SourceBlock',[get_param(lib_block_handle,'Parent') '/' get_param(lib_block_handle,'Name')])
end
Hope this helps,
~Zack
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Schedule Model Components についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!