www.gusucode.com > mbcdesign 工具箱 matlab 源码程序 > mbcdesign/@coninputfactor/subsref.m
function out = subsref(cif, S) %SUBSREF Subscripted reference for constraint input factor objects % % B = SUBSREF(A, S) % % CIF(I) % CIF.Name returns a cell-string of names % CIF.Symbol returns a cell-string of symbols % CIF.Unit returns a cell-string of units % CIF.Min returns a row vector of minimums % CIF.Max returns a row vector of maximums % CIF.Range returns a matrix with minimums in the first row and maximums in the % second row. % % If I is a scalar, then CIF(I).Name and CIF.Name(I) return cell-string with % one element but CIF.Name{I} returns a string. % % See also CONBASE, CONINPUTFACTOR, CONINPUTFACTOR/SUBSASGN. % Copyright 2004-2011 The MathWorks, Inc. switch S(1).type, case '()', if numel( S(1).subs ) ~= 1, error(message('mbc:coninputfactor:InvalidArguments21')); end i = S(1).subs{1}; out = cif; out.Name = out.Name(i); out.Symbol = out.Symbol(i); out.Unit = out.Unit(i); out.Min = out.Min(i); out.Max = out.Max(i); out = p_EnsureRows( out ); case '.', fn = lower( S(1).subs ); fn(1) = upper( fn(1) ); switch fn, case fieldnames( cif ), out = cif.(fn); case 'Range', out = [cif.Min; cif.Max]; otherwise error(message('mbc:coninputfactor:InvalidPropertyName')); end case '{}', error(message('mbc:coninputfactor:InvalidArguments22')); otherwise error(message('mbc:coninputfactor:InvalidArguments23')); end if length( S ) > 1, out = subsref( out, S(2:end) ); end %------------------------------------------------------------------------------| % EOF %------------------------------------------------------------------------------|