Mercurial > hg > ltpda
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f0afece42f48 |
---|---|
1 % SETSELECTION Sets the property 'selection'. | |
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
3 % | |
4 % DESCRIPTION: Set the property 'selection'. | |
5 % | |
6 % CALL: obj = obj.setSelection(SELECTION); | |
7 % obj = setSelection(obj, SELECTION); | |
8 % | |
9 % INPUTS: obj - single paramValue object | |
10 % SELECTION - one of the following values | |
11 % paramValue.OPTIONAL | |
12 % paramValue.SINGLE | |
13 % paramValue.MULTI | |
14 % | |
15 % REMARK: This method checks if the index is in range of the options | |
16 % | |
17 % VERSION: $Id: setSelection.m,v 1.1 2009/06/17 15:01:53 ingo Exp $ | |
18 % | |
19 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | |
20 | |
21 function varargout = setSelection(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 selection = 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 ~isnumeric(selection) | |
36 error('### Please specify a integer for the value index.'); | |
37 end | |
38 | |
39 obj = copy(obj, nargout); | |
40 | |
41 obj.selection = selection; | |
42 | |
43 %%% Prepare output | |
44 varargout{1} = obj; | |
45 | |
46 end |