comparison m-toolbox/classes/@paramValue/setOptions.m @ 0:f0afece42f48

Import.
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Wed, 23 Nov 2011 19:22:13 +0100
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:f0afece42f48
1 % SETOPTIONS Sets the property 'options'.
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %
4 % DESCRIPTION: Set the property 'options'.
5 %
6 % CALL: obj = obj.setOptions(options);
7 % obj = setOptions(obj, options);
8 %
9 % INPUTS: obj - single paramValue object
10 % options - new options
11 %
12 % REMARK: This method checks if the options have at lease as much
13 % elements as the 'valIndex'.
14 % If 'valIndex' is equal to -1 then is it possible to set each
15 % cell to options.
16 %
17 % VERSION: $Id: setOptions.m,v 1.1 2009/06/17 15:01:53 ingo Exp $
18 %
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
20
21 function varargout = setOptions(varargin)
22
23 %%% Check number in inputs
24 if nargin ~= 2
25 error('### This method accepts only two inputs. The first one must be the object and the second one an integer.');
26 end
27
28 obj = varargin{1};
29 options = varargin{2};
30
31 %%% Check the correctness of the inputs
32 if ~isa(obj, 'paramValue') || numel(obj) ~= 1
33 error('### The first input must be a single paramValue object.');
34 end
35 if ~iscell(options)
36 error('### Please specify a cell for the options.');
37 end
38
39 %%% Check if the 'options' have enough elements
40 if (obj.valIndex > 1) && (obj.valIndex > numel(options))
41 error('### The ''options'' must have at lease as much elements [%d] as the ''valIndex'' [%d]', numel(options), obj.valIndex);
42 end
43
44 obj = copy(obj, nargout);
45
46 obj.options = options;
47
48 %%% Prepare output
49 varargout{1} = obj;
50
51 end