root/branches/telle/v2.00-at/mfiles/@NXTmotor/get.m @ 393

Revision 393, 2.5 KB (checked in by telle, 5 years ago)

Edit comments

Line 
1function val = get(obj, prop)
2% GET Get NXTmotor object properties.
3%
4%     GET(OBJ) displays all property names and their current values for
5%     NXTmotor object OBJ.
6%
7%     V = GET(OBJ, 'PropertyName') returns the value, V, of the specified
8%     property, PropertyName, for NXTmotor object OBJ.
9%
10%     See also NXTmotor, NXTmotor/set, NXTmotor/display.
11%
12
13% Signature
14%   Author: Aulis Telle (see AUTHORS)
15%   Date: 2008/08/15
16%   Copyright: 2007-2008, RWTH Aachen University
17%
18%
19% ***********************************************************************************************
20% *  This file is part of the RWTH - Mindstorms NXT Toolbox.                                    *
21% *                                                                                             *
22% *  The RWTH - Mindstorms NXT Toolbox is free software: you can redistribute it and/or modify  *
23% *  it under the terms of the GNU General Public License as published by the Free Software     *
24% *  Foundation, either version 3 of the License, or (at your option) any later version.        *
25% *                                                                                             *
26% *  The RWTH - Mindstorms NXT Toolbox is distributed in the hope that it will be useful,       *
27% *  but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS  *
28% *  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
29% *                                                                                             *
30% *  You should have received a copy of the GNU General Public License along with the           *
31% *  RWTH - Mindstorms NXT Toolbox. If not, see <http://www.gnu.org/licenses/>.                 *
32% ***********************************************************************************************
33
34if ~isa(obj,'NXTmotor')
35    error('MATLAB:RWTHMindstormsNXT:InvalidObject',...
36        'No NXTmotor object.');
37end
38
39if nargin == 1 && nargout == 0
40    display(obj);
41    return;
42end
43
44
45if nargin > 1
46    switch prop
47        case 'Port'
48            val = obj.Port;
49        case 'Power'
50            val = obj.Power;
51        case 'SpeedRegulation'
52            val = obj.SpeedRegulation;
53        case 'TachoLimit'
54            val = obj.TachoLimit;
55        case 'BrakeAtTachoLimit'
56            val = obj.BrakeAtTachoLimit;
57        case 'TurnRatio'
58            val = obj.TurnRatio;
59        otherwise
60            error('MATLAB:RWTHMindstormsNXT:UnsupportedProperty',...
61                'Unsupported property %s', prop);
62    end
63end
Note: See TracBrowser for help on using the browser.