⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 size.m

📁 optimization toolbox
💻 M
字号:
function varargout=size(varargin)
%size              Returns the number of inequalities and equalities 
%   
%    n = SIZE(F)     Returns the number of inequalities
%    [n,m] = SIZE(F) Returns the number of inequalities and equalities
%
%    See also   LMI, ADDLMI

% Author Johan L鰂berg 
% $Id: size.m,v 1.3 2005/02/04 10:10:27 johanl Exp $   

F = varargin{1};
nequ = 0;
nlmi = 0;
for i = 1:size(F.clauses,2)
    if F.clauses{i}.type==3
        nequ = nequ + 1;
    else
        nlmi = nlmi + 1;
    end
end

if nargin == 1  
  switch (nargout)
  case {0,1}
    varargout{1} = nlmi;
  case 2
    varargout{1} = nlmi;
    varargout{2} = nequ;
  otherwise
    error('>2 outputs in size?');
  end
else
	switch(varargin{2})
	case 1
		varargout{1} = nlmi;
	case 2
		varargout{1} = nequ;
	otherwise
		error('Second argument should be 1 (# LMIs) or 2 (# equalities)');
	end
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -