/[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.2 - (show annotations) (download)
Thu Oct 20 20:57:02 2011 UTC (13 years, 8 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65r, checkpoint65p, checkpoint65q, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
Changes since 1.1: +4 -0 lines
Error occurred while calculating annotation data.
- add help sections at the top.

1 function b = subsref(a,index)
2 %overloaded gcmfaces subsref function : subscripted reference according to
3 % beta{n} will return the n^{th} face data (array).
4 % beta(:,:,n) will return the n^{th} vertical level (gcmfaces).
5 % beta.nFaces will return the nFaces attribute (double).
6
7 switch index(1).type
8 case '{}'
9 nFaces=get(a,'nFaces');
10 iFace=index(1).subs{:};
11 if iFace<=nFaces&iFace>0;
12 eval(['b=a.f' num2str(iFace) ';']);
13 else
14 error('Index out of range')
15 end
16
17 if length(index)>1; b=subsref(b,index(2:end)); end;
18 case '.'
19 b = get(a,index(1).subs);
20
21 if length(index)>1; b=subsref(b,index(2:end)); end;
22 case '()'
23 if length(index)>1; error('indexing not supported by gcmfaces objects'); end;
24
25 b=a;
26 for iFace=1:a.nFaces; iF=num2str(iFace);
27 if isa(index.subs{1},'gcmfaces');
28 eval(['b.f' iF '=a.f' iF '(index.subs{1}.f' iF ');']);
29 else;
30 eval(['b.f' iF '=subsref(a.f' iF ',index);']);
31 end;
32 end;
33 otherwise
34 error('indexing not supported by gcmfaces objects')
35 end
36
37

  ViewVC Help
Powered by ViewVC 1.1.22