Update library repository for simulink custom library

14 Ansichten (letzte 30 Tage)
Martin
Martin am 17 Nov. 2014
Kommentiert: Martin am 8 Feb. 2016
Hi,
I have a custom simulink created with R2012b. When opening it in R2014b for the first time, I get a message that repository information is missing for the library. Is there a way to auto-generate that information? Note that simply saving the library in R2014b is no option, as I cannot load it in R2012b after that any longer.
So far, I tried the following:
1. Set the parameter 'EnableLBRepository' in R2012b. That did not work, reading the parameter in R2014b returned 'off' while in R2012b, it returned 'on'.
2. I added the following code to slblocks.m:
if (~verLessThan('matlab', '8.4')) % R2014b
% Add repository information if not yet done
try
load_system('canoelib');
if (strcmp(get_param('canoelib', 'EnableLBRepository'), 'off'))
set_param('canoelib', 'Lock', 'off');
set_param('canoelib', 'EnableLBRepository', 'on');
set_param('canoelib', 'Lock', 'on');
save_system('canoelib');
end;
close_system('canoelib');
catch ex
end
end;
That worked, but it will fail if MATLAB is installed in C:\Program Files and the user starts it without Admin rights (canoelib.slx will be write-protected in that case).
What I'm looking for is a solution similar to 2., but without saving the configuration. Is there a way to update the repository information for a library in memory by script?
Many thanks in advance, Martin
  1 Kommentar
Todd
Todd am 19 Nov. 2014
One possible problem with the slblocks code you have is that it saves the file in R2014b, which is what you wanted to avoid in the first place.
I also have this problem, and have not found a solution (other than maintaining two parallel libraries, which is not always possible.)

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Subhadra Mahanti
Subhadra Mahanti am 21 Jan. 2016
Bearbeitet: Subhadra Mahanti am 21 Jan. 2016
The following flag ' Choice' needs to be added to your SLBLOCKS file. The flag indicates that the SLBLOCKS author wants to repeat the requested action for the library (and all sub-libraries) and not show a notification bar to ‘Fix missing RPS’ even if the repository info is missing for either the parent library or any of its child libraries.
%%Example: In your SLBLOCKS file, add the following line:
% if you don't want to save your library as SLX but want to instead generate the required info in memory without any further prompts.
Browser(1).Choice=1 ;
NOTE: The available values of choice are:
Choice=0: Resave the library as SLX
Choice=1: Generate the required repository info in memory
Choice=2: Skip. If the user chooses 2, their library won’t show up in the Library Browser at all since repository info is missing
  2 Kommentare
James Marriott
James Marriott am 2 Feb. 2016
perfect response, I also had this issue!!
Thanks
Martin
Martin am 8 Feb. 2016
Thanks, that works :-)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Environment Customization 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!

Translated by