0001 function elem = subsref(tt,s)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 switch s(1).type
0017 case '()'
0018 error('Elementwise computation is not yet supported');
0019 case '.'
0020 switch s(1).subs
0021 case 'n'
0022 elem=tt.n;
0023 if (numel(s)>1)
0024 s = s(2:end);
0025 elem = subsref(elem, s);
0026 end;
0027 case 'm'
0028 elem=tt.m;
0029 if (numel(s)>1)
0030 s = s(2:end);
0031 elem = subsref(elem, s);
0032 end;
0033 case 'tt'
0034 elem=tt.tt;
0035 otherwise
0036
0037 elem = subsref(tt.tt, s);
0038 if (numel(s)>1)
0039 s = s(2:end);
0040 elem = subsref(elem, s);
0041 end;
0042
0043 end
0044 case '{}'
0045 pp=s.subs;
0046 mn=numel(pp);
0047 if ( mn > 1 )
0048 error('Invalid number of cores asked');
0049 end
0050 pp = pp{1};
0051 elem=core(tt.tt,pp);
0052 elem=reshape(elem, tt.tt.r(pp), tt.n(pp), tt.m(pp), tt.tt.r(pp+1));
0053
0054 if (numel(s)>1)
0055 s = s(2:end);
0056 elem = subsref(elem, s);
0057 end;
0058 otherwise
0059 error('Invalid subsref.');
0060 end