annotate toolboxes/MIRtoolbox1.3.2/MIRToolbox/@mirstruct/subsref.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function b = subsref(a,index)
Daniel@0 2 % Define field name indexing for mirstruct objects
Daniel@0 3 switch index(1).type
Daniel@0 4 case '.'
Daniel@0 5 if strcmpi(index(1).subs,'tmp')
Daniel@0 6 if length(index)== 1
Daniel@0 7 b = [];
Daniel@0 8 else
Daniel@0 9 if length(index)>2
Daniel@0 10 if strcmpi(index(3).type,'{}')
Daniel@0 11 isubs = index(3).subs;
Daniel@0 12 if length(isubs)>1
Daniel@0 13 b = a.tmp.(index(2).subs){isubs{1},isubs{2}};
Daniel@0 14 else
Daniel@0 15 b = a.tmp.(index(2).subs){isubs{1}};
Daniel@0 16 end
Daniel@0 17 end
Daniel@0 18 else
Daniel@0 19 b = a.tmp.(index(2).subs);
Daniel@0 20 end
Daniel@0 21 end
Daniel@0 22 return
Daniel@0 23 end
Daniel@0 24 [is,id] = ismember(index(1).subs,a.fields);
Daniel@0 25 if length(index) == 1
Daniel@0 26 b = a.data{id};
Daniel@0 27 else
Daniel@0 28 b = subsref(a.data{id},index(2:end));
Daniel@0 29 end
Daniel@0 30 end