Newer
Older
function self = subsasgn(self, s, val)
% Subscripted assignment for object Hashtable
% -------------------------------------------
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
41
42
43
44
45
46
47
48
49
50
% see help for subsasgn
% ---------------------
switch (length(s))
case 3
switch s(3).type
case '.'
h = get(self.dynaload, s(1).subs);
t = get(h, s(2).subs);
t.(s(3).subs) = val;
h = put(h, s(2).subs, t);
self = put(self, s(1).subs, h);
otherwise
error('Invalid type.')
end
case 2
switch s(1).type
case '.'
if isstruct(val)
h = get(self.dynaload, s(1).subs);
h = put(h, s(2).subs, val);
self = put(self, s(1).subs, h);
else
error('value must be a structure');
end
otherwise
error('Invalid type.')
end
case 1
switch s.type
case '()'
if (length(s.subs) ~= 1)
error('Only single indexing is supported.');
end
self = put(self, s.subs{1}, val);
case '.'
switch s.subs
case {'autonan', 'autoscale' }
builtin('subsasgn', self, s, val);
otherwise
self = put(self, s.subs, val);
end
otherwise
error('Invalid type.')
end
end