You need to be very careful about this type of operation. Depending on what do you mean by "parameters", I am not sure if you can merge the changes made both on the library blocks and the instantiated blocks in the model. But if you say that the GUI operation via Link OPtions -> Restore Link can achieve what you want, then you can do it in script. Try an example first to make sure it works before you apply to the whole model.
LibraryBlocks=find_system(MyModel,'FollowLinks','On','LookUnderMasks','All',...
'LinkStatus','inactive');
for i=length(LibraryBlocks):-1:1
try
Lib_Model=get_param(LibraryBlocks{i},'AncestorBlock');
Lib_Model=regexprep(Lib_Model,'/.+','');
open_system(Lib_Model);
set_param(LibraryBlocks{i},'LinkStatus','restore');
fprintf(1, 'Info: Restore block ''%s'' from library file "%s".\n\n',LibraryBlocks{i},Lib_Model);
catch
fprintf(2, 'ERROR: Can not restore block ''%s'' to library file "%s".\n\n',LibraryBlocks{i},Lib_Model);
end
end
Best Answer