How order my own Simulink library in folders?
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (1)
Zack Peters
le 8 Nov 2013
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 commentaires
Voir également
Catégories
En savoir plus sur Schedule Model Components dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!