]> rtime.felk.cvut.cz Git - pes-rpp/rpp-simulink.git/blob - rpp/demos/rpp_demos_set_tg.m
doc: Update documentation of external mode and related stuff
[pes-rpp/rpp-simulink.git] / rpp / demos / rpp_demos_set_tg.m
1 % Copyright (C) 2013-2014 Czech Technical University in Prague
2 %
3 % Authors:
4 %     - Michal Horn <hornmich@fel.cvut.cz>
5 %
6 % This document contains proprietary information belonging to Czech
7 % Technical University in Prague. Passing on and copying of this
8 % document, and communication of its contents is not permitted
9 % without prior written authorization.
10 %
11 % File : rpp_demos_set_tg.m
12 % Abstract:
13 %     Set target file for demo, preserving selected solver and
14 %     continuous time support
15 %
16 % References:
17 %     http://www.mathworks.com/help/matlab/ref/mex.html
18 %     http://www.mathworks.com/help/matlab/matlab_external/custom-building-mex-files.html
19
20
21 function rpp_demos_set_tg(varargin)
22         d = fullfile(getpref('rpp', 'TargetRoot'), '..', 'demos');
23         cd(d)
24         
25         if nargin > 1,
26                 reqTarget = varargin{1};
27                 demos_set_tg(reqTarget, varargin)
28         else
29                 error('Not enough arguments for the function.');
30         end
31
32 function demos_set_tg(reqTg, files)
33         for i=2:length(files),
34                 disp(['Processing system: ', files{i}]);
35                 load_system(files{i});
36                 continuousTime = get_param(files{i}, 'SupportContinuousTime');
37                 solver = get_param(files{i}, 'Solver');
38                 disp(['    Set SystemTargetFile to ', reqTg, ' with continuousTime ', continuousTime, ' and solver ', solver]);
39                 set_param(files{i}, 'SystemTargetFile', reqTg);
40                 set_param(files{i}, 'SupportContinuousTime', continuousTime);
41                 set_param(files{i}, 'Solver', solver);
42                 disp('    Saving and closing model.');
43                 close_system(files{i}, 1);
44         end
45