Switch to unified view

a b/functions/@eegobj/subsref.m
1
% support function for eegobj
2
3
function varargout = subsref(this,s)
4
5
if strcmpi(s(1).type, '()') && length(this) > 1
6
    %if length(s(1).subs{1})
7
    %    error('Unsuported object feature - a.field or a([x y]).field is not supported for object arrays');
8
    %end
9
    
10
%     if length(s) == 1
11
%         b = this(s(1).subs{1});
12
%     else
13
%         b = builtin('subsref', this(s(1).subs{1}).EEG, s(2:end));
14
%     end
15
    
16
    if length(s) == 1
17
        varargout{1} = this(s(1).subs{1});
18
    elseif length(s(1).subs{1}) > 1
19
        for index = 1:length(s(1).subs{1})
20
            varargout{1}{index} = builtin('subsref', this(s(1).subs{1}(index)).EEG, s(2:end));
21
        end
22
    else  
23
        varargout{1} = builtin('subsref', this(s(1).subs{1}).EEG, s(2:end));
24
    end
25
elseif strcmpi(s(1).type, '.') && length(this) > 1
26
    for index = 1:length(this)
27
        varargout{index} = builtin('subsref', this(index).EEG, s);
28
    end
29
    %if length(s) > 1 && iscell(s(2).subs) && length(s(2).subs{1})
30
    %    error('Unsuported object feature - a.field or a([x y]).field is not supported for object arrays');
31
    %end
32
else
33
    varargout{1} = builtin('subsref', this.EEG, s);
34
end
35
36
37
% return;
38
% 
39
% % SUBSREF 
40
% switch s.type
41
% case '()'
42
%     b = getfield(a.rawbit, s.subs);
43
% case '.'
44
%     b = getfield(struct(a), s.subs);
45
% otherwise
46
%    error('Wrong class argument')
47
% end