Line | |
---|
1 | function varargout=size(varargin) |
---|
2 | %size Returns the number of inequalities and equalities |
---|
3 | % |
---|
4 | % n = SIZE(F) Returns the number of inequalities |
---|
5 | % [n,m] = SIZE(F) Returns the number of inequalities and equalities |
---|
6 | % |
---|
7 | % See also LMI, ADDLMI |
---|
8 | |
---|
9 | % Author Johan Löfberg |
---|
10 | % $Id: size.m,v 1.3 2005/02/04 10:10:27 johanl Exp $ |
---|
11 | |
---|
12 | F = varargin{1}; |
---|
13 | nequ = 0; |
---|
14 | nlmi = 0; |
---|
15 | for i = 1:size(F.clauses,2) |
---|
16 | if F.clauses{i}.type==3 |
---|
17 | nequ = nequ + 1; |
---|
18 | else |
---|
19 | nlmi = nlmi + 1; |
---|
20 | end |
---|
21 | end |
---|
22 | |
---|
23 | if nargin == 1 |
---|
24 | switch (nargout) |
---|
25 | case {0,1} |
---|
26 | varargout{1} = nlmi; |
---|
27 | case 2 |
---|
28 | varargout{1} = nlmi; |
---|
29 | varargout{2} = nequ; |
---|
30 | otherwise |
---|
31 | error('>2 outputs in size?'); |
---|
32 | end |
---|
33 | else |
---|
34 | switch(varargin{2}) |
---|
35 | case 1 |
---|
36 | varargout{1} = nlmi; |
---|
37 | case 2 |
---|
38 | varargout{1} = nequ; |
---|
39 | otherwise |
---|
40 | error('Second argument should be 1 (# LMIs) or 2 (# equalities)'); |
---|
41 | end |
---|
42 | end |
---|
Note: See
TracBrowser
for help on using the repository browser.