/[MITgcm]/MITgcm_contrib/gael/matlab_class/@gcmfaces/subsref.m
ViewVC logotype

Contents of /MITgcm_contrib/gael/matlab_class/@gcmfaces/subsref.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Wed Feb 10 14:43:48 2010 UTC (15 years, 5 months ago) by gforget
Branch: MAIN
matlab_class core routine: gcmfaces methods

1 function b = subsref(a,index)
2
3 switch index(1).type
4 case '{}'
5 nFaces=get(a,'nFaces');
6 iFace=index(1).subs{:};
7 if iFace<=nFaces&iFace>0;
8 eval(['b=a.f' num2str(iFace) ';']);
9 else
10 error('Index out of range')
11 end
12
13 if length(index)>1; b=subsref(b,index(2:end)); end;
14 case '.'
15 b = get(a,index(1).subs);
16
17 if length(index)>1; b=subsref(b,index(2:end)); end;
18 case '()'
19 if length(index)>1; error('indexing not supported by gcmfaces objects'); end;
20
21 b=a;
22 for iFace=1:a.nFaces; iF=num2str(iFace);
23 if isa(index.subs{1},'gcmfaces');
24 eval(['b.f' iF '=a.f' iF '(index.subs{1}.f' iF ');']);
25 else;
26 eval(['b.f' iF '=subsref(a.f' iF ',index);']);
27 end;
28 end;
29 otherwise
30 error('indexing not supported by gcmfaces objects')
31 end
32
33

  ViewVC Help
Powered by ViewVC 1.1.22