Index: branches/telle/RWTHMindstormsNXT/@NXTmotor/NXTmotor.m
===================================================================
--- branches/telle/RWTHMindstormsNXT/@NXTmotor/NXTmotor.m	(revision 221)
+++ branches/telle/RWTHMindstormsNXT/@NXTmotor/NXTmotor.m	(revision 246)
@@ -31,9 +31,7 @@
 % Author: Aulis Telle, IND, RWTH Aachen
 
-data = [];
 
 if nargin > 0 && isa(varargin{1}, 'NXTmotor')
-    tmp = varargin{1};
-    data = tmp.data();
+    obj = varargin{1};
 else
     port = 0;
@@ -60,64 +58,20 @@
     end
 
-    data.port           = port;
-    data.power          = 0;
-    data.mode.motorOn   = 1;
-    data.mode.brake     = 1;
-    data.regulationMode = 'IDLE';
-    data.turnRatio      = 0;
-    data.runState       = 'RUNNING';
-    data.tachoLimit     = 0;
+    obj.port           = port;
+    obj.power          = 0;
+    obj.motorOn        = 1;
+    obj.brake          = 1;
+    obj.regulationMode = 'IDLE';
+    obj.turnRatio      = 0;
+    obj.runState       = 'RUNNING';
+    obj.tachoLimit     = 0;
 end
 
-
-obj.data = @dataClosure;
 
 obj = class(obj, 'NXTmotor');
 
 if nargin > 1
-    set(obj, varargin{2:end});
+    obj = set(obj, varargin{2:end});
 end
-
-% This is the nested function for the function closure. The variable
-% "data", which is in the scope of the outer function, can be accessed from
-% within the nested function. A handel to this function is returned to the
-% caller of the outer function. This makes the variable "data" persistent
-% and from now on it can be accessed from within the nested function, even
-% when it is called from another scope.
-function val = dataClosure(varargin)
-
-    % if there are two arguments, this indicates, that a property field
-    % shall be set. varargin{1} is the field name and varargin{2} the 
-    % value, to which it should be set.
-    if nargin == 2
-        switch varargin{1}
-            case {'port'}
-                data.port = varargin{2};
-                
-            case {'power'}
-                data.power = varargin{2};
-                
-            case {'motorOn'}
-                data.mode.motorOn = varargin{2};
-    
-            case {'brake'}
-                data.mode.brake = varargin{2};
-    
-            case {'regulationMode'}
-                data.regulationMode = varargin{2};
-    
-            case {'turnRatio'}
-                data.turnRatio = varargin{2};
-    
-            case {'runState'}
-                data.runState = varargin{2};
-    
-            case {'tachoLimit'}
-                data.tachoLimit = varargin{2};
-        end
-    end
-    val = data;
-end
-% END OF NESTED FUNCTION dataClosure()
 
 end
