Mercurial > hg > camir-aes2014
annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirstruct/subsref.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
rev | line source |
---|---|
wolffd@0 | 1 function b = subsref(a,index) |
wolffd@0 | 2 % Define field name indexing for mirstruct objects |
wolffd@0 | 3 switch index(1).type |
wolffd@0 | 4 case '.' |
wolffd@0 | 5 if strcmpi(index(1).subs,'tmp') |
wolffd@0 | 6 if length(index)== 1 |
wolffd@0 | 7 b = []; |
wolffd@0 | 8 else |
wolffd@0 | 9 if length(index)>2 |
wolffd@0 | 10 if strcmpi(index(3).type,'{}') |
wolffd@0 | 11 isubs = index(3).subs; |
wolffd@0 | 12 if length(isubs)>1 |
wolffd@0 | 13 b = a.tmp.(index(2).subs){isubs{1},isubs{2}}; |
wolffd@0 | 14 else |
wolffd@0 | 15 b = a.tmp.(index(2).subs){isubs{1}}; |
wolffd@0 | 16 end |
wolffd@0 | 17 end |
wolffd@0 | 18 else |
wolffd@0 | 19 b = a.tmp.(index(2).subs); |
wolffd@0 | 20 end |
wolffd@0 | 21 end |
wolffd@0 | 22 return |
wolffd@0 | 23 end |
wolffd@0 | 24 [is,id] = ismember(index(1).subs,a.fields); |
wolffd@0 | 25 if length(index) == 1 |
wolffd@0 | 26 b = a.data{id}; |
wolffd@0 | 27 else |
wolffd@0 | 28 b = subsref(a.data{id},index(2:end)); |
wolffd@0 | 29 end |
wolffd@0 | 30 end |