-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathexport_library.m
35 lines (28 loc) · 1.13 KB
/
export_library.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
% Copyright (C) 2018 Istituto Italiano di Tecnologia (IIT). All rights reserved.
% This software may be modified and distributed under the terms of the
% GNU Lesser General Public License v2.1 or any later version.
fprintf('\nWhole Body toolbox exporting library to old Simulink version\n');
addpath(genpath('library'));
libraryName = 'WBToolboxLibrary_repository';
try
% Load the library
open_system(libraryName,'loadonly');
fprintf('\nLibrary loaded\n');
% Enable library capabilities
if (strcmp(get_param(libraryName, 'EnableLBRepository'), 'off'))
set_param(libraryName, 'Lock', 'off');
set_param(libraryName, 'EnableLBRepository', 'on');
set_param(libraryName, 'Lock', 'on');
end
% Export the library. It must be in slx otherwise it will not show up in
% the Simulink Library browser.
fprintf('\nExporting for 2016b\n');
save_system(libraryName, 'WBToolboxLibrary', 'ExportToVersion', 'R2016B_SLX');
movefile('WBToolboxLibrary.slx', 'library/exported/WBToolboxLibrary.slx');
% Unload the library
close_system(libraryName);
catch
error('Failed to export WBToolbox library')
end
fprintf('\nDone\n');
exit(0)