]> Creatis software - CreaPhase.git/blob - octave_packages/control-2.3.52/@lti/get.m
Add a useful package (from Source forge) for octave
[CreaPhase.git] / octave_packages / control-2.3.52 / @lti / get.m
1 ## Copyright (C) 2009, 2010   Lukas F. Reichlin
2 ##
3 ## This file is part of LTI Syncope.
4 ##
5 ## LTI Syncope is free software: you can redistribute it and/or modify
6 ## it under the terms of the GNU General Public License as published by
7 ## the Free Software Foundation, either version 3 of the License, or
8 ## (at your option) any later version.
9 ##
10 ## LTI Syncope is distributed in the hope that it will be useful,
11 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
12 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 ## GNU General Public License for more details.
14 ##
15 ## You should have received a copy of the GNU General Public License
16 ## along with LTI Syncope.  If not, see <http://www.gnu.org/licenses/>.
17
18 ## -*- texinfo -*-
19 ## @deftypefn {Function File} get (@var{sys})
20 ## @deftypefnx {Function File} {@var{value} =} get (@var{sys}, @var{"property"})
21 ## Access property values of LTI objects.
22 ## @end deftypefn
23
24 ## Author: Lukas Reichlin <lukas.reichlin@gmail.com>
25 ## Created: October 2009
26 ## Version: 0.2
27
28 function varargout = get (sys, varargin)
29
30   if (nargin == 1)
31     [props, vals] = __property_names__ (sys);
32     nrows = numel (props);
33     str = strjust (strvcat (props), "right");
34     str = horzcat (repmat ("   ", nrows, 1), str, repmat (":  ", nrows, 1), strvcat (vals));
35     disp (str);
36   else
37     for k = 1 : (nargin-1)
38       prop = lower (varargin{k});
39
40       switch (prop)
41         case {"inname", "inputname"}
42           val = sys.inname;
43         case {"outname", "outputname"}
44           val = sys.outname;
45         case {"tsam", "ts"}
46           val = sys.tsam;
47         case "name"
48           val = sys.name;
49         case "notes"
50           val = sys.notes;
51         case "userdata"
52           val = sys.userdata;
53         otherwise
54           val = __get__ (sys, prop);
55       endswitch
56
57       varargout{k} = val;
58     endfor
59   endif
60
61 endfunction