www.gusucode.com > mbcexpr 工具箱 matlab 源码程序 > mbcexpr/@cgclipexpr/set.m

    function varargout = set(varargin)
%SET Standard set method
%
%  Sets the properties of the cgclipexpr object.
%
%  Usage: out = set(c , 'property_name', value)

%  Copyright 2000-2004 The MathWorks, Inc. and Ford Global Technologies, Inc.


if nargin == 1
    varargout{1} = i_ShowFields;
else
    if nargin < 3
        error(message('mbc:cgclipexpr:InvalidArgument4'));
    end
    
    c = varargin{1};        
    for n = 2:2:nargin
        property = varargin{n};
        new_value = varargin{n+1};
        
        if ~ischar(property)
            error(message('mbc:cgclipexpr:InvalidArgument5'));
        end
        
        switch lower(property)
            case 'bound'
                if ~isa(new_value , 'double')
                    error(message('mbc:cgclipexpr:InvalidPropertyValue'));
                end
                L = numel(new_value);
                if L~=2
                    error(message('mbc:cgclipexpr:InvalidPropertyValue'));
                end
                c.bound = new_value;
            case 'input'
                if isa(new_value,'xregpointer')
                    c = setinputs(c, new_value(1));
                else
                    error(message('mbc:cgclipexpr:InvalidPropertyValue2'));
                end
            otherwise
                error(message('mbc:cgclipexpr:InvalidPropertyName', property)); 
        end
    end
    
    %If we are out here, then we should be able to set the property of the object.
    if nargout > 0
        varargout{1} = c;
    elseif ~isempty(inputname(1))
        assignin('caller' , inputname(1) , c);
    end    
end



function out = i_ShowFields
%Simply returns a structure, the fieldnames of which are the set-able
%fields of the Value object, and the fields contain more details.
out.bounds = 'double [min max]';
out.input = 'pointer to cgexpr';