Mercurial > repos > public > sbplib
comparison Cell.m @ 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 | 1dcac646c514 |
comparison
equal
deleted
inserted
replaced
468:13362cf4dd89 | 469:365fcdbb8736 |
---|---|
26 function disp(A) | 26 function disp(A) |
27 disp(A.data) | 27 disp(A.data) |
28 end | 28 end |
29 | 29 |
30 function A = subsasgn(A, S, B) | 30 function A = subsasgn(A, S, B) |
31 disp(S); | |
32 a = subsasgn(A.data, S, B); | 31 a = subsasgn(A.data, S, B); |
33 A = callConstructor(A, a); | 32 A = callConstructor(A, a); |
34 end | 33 end |
35 | 34 |
36 function B = subsref(A, S) | 35 function B = subsref(A, S) |
37 disp(S); | 36 switch S(1).type |
38 B = subsref(A.data, S); | 37 case '()' |
39 % Wrong if type is '()', '.' | 38 b = subsref(A.data, S); |
39 B = callConstructor(A, b); | |
40 case '{}' | |
41 B = subsref(A.data, S); | |
42 case '.' | |
43 B = builtin('subsref',A, S); | |
44 otherwise | |
45 error('impossible') | |
46 end | |
40 end | 47 end |
41 | 48 |
42 function C = horzcat(varargin) | 49 function C = horzcat(varargin) |
43 dataArray = cell(1, length(varargin)); | 50 dataArray = cell(1, length(varargin)); |
44 | 51 |