Mercurial > hg > ltpda
diff m-toolbox/classes/@paramValue/setSelection.m @ 0:f0afece42f48
Import.
author | Daniele Nicolodi <nicolodi@science.unitn.it> |
---|---|
date | Wed, 23 Nov 2011 19:22:13 +0100 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/m-toolbox/classes/@paramValue/setSelection.m Wed Nov 23 19:22:13 2011 +0100 @@ -0,0 +1,46 @@ +% SETSELECTION Sets the property 'selection'. +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% DESCRIPTION: Set the property 'selection'. +% +% CALL: obj = obj.setSelection(SELECTION); +% obj = setSelection(obj, SELECTION); +% +% INPUTS: obj - single paramValue object +% SELECTION - one of the following values +% paramValue.OPTIONAL +% paramValue.SINGLE +% paramValue.MULTI +% +% REMARK: This method checks if the index is in range of the options +% +% VERSION: $Id: setSelection.m,v 1.1 2009/06/17 15:01:53 ingo Exp $ +% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +function varargout = setSelection(varargin) + + %%% Check number in inputs + if nargin ~= 2 + error('### This method accepts only two inputs. The first one must be the object and the second one an integer.'); + end + + obj = varargin{1}; + selection = varargin{2}; + + %%% Check the correctness of the inputs + if ~isa(obj, 'paramValue') || numel(obj) ~= 1 + error('### The first input must be a single paramValue object.'); + end + if ~isnumeric(selection) + error('### Please specify a integer for the value index.'); + end + + obj = copy(obj, nargout); + + obj.selection = selection; + + %%% Prepare output + varargout{1} = obj; + +end