changeset 469:365fcdbb8736 feature/sublassable_cellarray

Implement subsref properly
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 01 Aug 2017 12:59:06 +0200
parents 13362cf4dd89
children 428cc9d4106f
files Cell.m
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
diff -r 13362cf4dd89 -r 365fcdbb8736 Cell.m
--- a/Cell.m	Tue Aug 01 12:41:42 2017 +0200
+++ b/Cell.m	Tue Aug 01 12:59:06 2017 +0200
@@ -28,15 +28,22 @@
         end
 
         function A = subsasgn(A, S, B)
-            disp(S);
             a = subsasgn(A.data, S, B);
             A = callConstructor(A, a);
         end
 
         function B = subsref(A, S)
-            disp(S);
-            B = subsref(A.data, S);
-            % Wrong if type is '()', '.'
+            switch S(1).type
+                case '()'
+                    b = subsref(A.data, S);
+                    B = callConstructor(A, b);
+                case '{}'
+                    B = subsref(A.data, S);
+                case '.'
+                    B = builtin('subsref',A, S);
+                otherwise
+                    error('impossible')
+            end
         end
 
         function C = horzcat(varargin)