Newer
Older

jacques.grelet_ird.fr
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
function val = subsref(self, s)
% Subscripted assignment for object dynaload
% overloading subscripted reference for objects
% Dot Notation vs. Function Notation
%
% see help from substruct and subsref
%
% $Id$
switch (length(s))
case 3
switch s(1).type
case '.'
val = get(self, s(1).subs);
val = val.(s(2).subs);
val = val.(s(3).subs);
otherwise
error('Invalid type.')
end
case 2
switch s(1).type
case '.'
val = get(self, s(1).subs);
val = val.(s(2).subs);
otherwise
error('Invalid type.')
end
case 1
switch s.type
case '()'
if (length(s.subs) ~= 1)
error('Only single indexing is supported.');
end
val = get(self, s.subs{1});
case '.'
val = get(self, s.subs);
otherwise
error('Invalid type.')
end
end