- You can use the sl_refresh_customizations command in the ‘PostSaveFcn’ Callback which refreshes any customization involved in the current MATLAB session
- Alternately, you can also use Simulink.LibraryDictionary.refresh function which updates the Simulink Library dictionary dependencies.
- In case you are working with Simulink models, and you want to update the custom library blocks, you can use the following command that refreshes the model and updates the mask diagram in the model, also updating the library blocks.
Redraw/update block mask within a custom Simulink library
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi MathWorks community,
I am trying to solve a task that probably is rather easy, but I have not manged to finde a solution yet I really hope it is not just a case of me not being able to use google.
I am working with a custom Simulink library. On the top layer of that library I added an empty subsystem/block with a mask that displays information regarding the current version of the library: the save date and who it was saved by. My code in the "Icon & Ports" part of the Mask Editor looks as follows:
% Library path:
path = which(bdroot);
% Save date:
libDir = dir(path);
dateNum = libDir.datenum;
format = 'dd-mmm-yyyy HH:MM';
% Saved by:
libInfo = Simulink.MDLInfo(path);
% Dispaly Version Information of Library:
text(0.5,0.2,['{\fontsize{8}{\itSave date: }',datestr(dateNum, format),...
' // {\itSaved by: }',libInfo.LastModifiedBy,'}'],...
'horizontalAlignment','center','verticalAlignment','middle','texmode','on');
This all works perfectly fine, the only probnlem is, that the text/mask does not automatically update after I saved the library. I have to either close and open the whole library again, or open and close the mask editor so that the mask is redrawn.
I know that I can creat a PostSaveFcn Callback for either the sinbgle block or the whole liobrary, but I have no clue what function I should call. Is there something like a "redraw" command for a single block or an "update masks" function for a library?
Thanks in advance for your comments and help :)
Benedikt
0 Kommentare
Antworten (1)
Chaitanya Krishna Kantambhatla
am 7 Sep. 2022
I Understand that you are trying to update the mask after you save.
You can try the following ways to refresh your Library browser.
set_param(<your model>,'SimulationCommand','Update')
Siehe auch
Kategorien
Mehr zu Author Block Masks finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!