source: issm/oecreview/Archive/11881-11894/ISSM-11891-11892.diff@ 11991

Last change on this file since 11991 was 11991, checked in by Eric.Larour, 13 years ago

oecreview from 11518 to present

File size: 3.5 KB
RevLine 
[11991]1Index: /proj/ice/larour/issm-uci-clean/trunk-jpl/src/m/classes/plotoptions.m
2===================================================================
3--- /proj/ice/larour/issm-uci-clean/trunk-jpl/src/m/classes/plotoptions.m (revision 11891)
4+++ /proj/ice/larour/issm-uci-clean/trunk-jpl/src/m/classes/plotoptions.m (revision 11892)
5@@ -47,8 +47,21 @@
6 error('buildlist error message: an even number of plotoptions is required')
7 end
8
9- %first: build a pairoptions out of varargin:
10+ %go through varargin and build list (like pairoptions)
11 rawoptions=pairoptions(varargin{:});
12+ numoptions = (nargin-1)/2;
13+ rawlist=cell(numoptions,2);
14+ for i=1:numoptions,
15+ if ischar(varargin{2*i-1}),
16+ rawlist{i,1}=varargin{2*i-1};
17+ rawlist{i,2}=varargin{2*i};
18+ else
19+ %option is not a string, ignore it
20+ disp(['WARNING: option number ' num2str(i) ' is not a string, it will be ignored']);
21+ rawlist(i,:)=[];
22+ continue
23+ end
24+ end
25
26 %get figure number
27 opt.figurenumber=getfieldvalue(rawoptions,'figure',1);
28@@ -71,19 +84,19 @@
29 end
30
31 %process plot options
32- for i=1:size(rawoptions.list,1),
33+ for i=1:size(rawlist,1),
34
35 %If alloptions flag has is on, apply to all plots
36- if (allflag & ~strcmpi(rawoptions.list{i,1},'data') & ~ismember('#',rawoptions.list{i,1})),
37+ if (allflag & ~strcmpi(rawlist{i,1},'data') & ~ismember('#',rawlist{i,1})),
38 for j=1:numberofplots,
39- opt.list{j}=addfield(opt.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
40+ opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2});
41 end
42
43 %option contains '#'
44- elseif ismember('#',rawoptions.list{i,1}),
45+ elseif ismember('#',rawlist{i,1}),
46
47 %get suplot(s) associated
48- string=strsplit(rawoptions.list{i,1},'#');
49+ string=strsplit(rawlist{i,1},'#');
50 plotnums=string{end};
51 field=string{1};
52
53@@ -101,7 +114,7 @@
54 %#all
55 elseif strcmpi(plotnum,'all');
56 for j=1:numberofplots,
57- opt.list{j}=addfield(opt.list{j},field,rawoptions.list{i,2});
58+ opt.list{j}=addfield(opt.list{j},field,rawlist{i,2});
59 end
60
61 %#i-j
62@@ -112,7 +125,7 @@
63 error(['the option #i-j is not set properly for ' field]);
64 end
65 for j=nums(1):nums(2),
66- opt.list{j}=addfield(opt.list{j},field,rawoptions.list{i,2});
67+ opt.list{j}=addfield(opt.list{j},field,rawlist{i,2});
68 end
69
70 %#i
71@@ -121,7 +134,7 @@
72 if str2num(plotnum)>numberofplots,
73 error(['opt error message: ' field ' cannot be assigned (' plotnum ' exceed maximum number of plot)']);
74 end
75- opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,rawoptions.list{i,2});
76+ opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,rawlist{i,2});
77 end
78 end
79
80@@ -131,15 +144,15 @@
81 %go through all subplot and assign to the first one free
82 j=1;
83 while (j<=numberofplots),
84- if ~exist(opt.list{j},rawoptions.list{i,1});
85- opt.list{j}=addfield(opt.list{j},rawoptions.list{i,1},rawoptions.list{i,2});
86+ if ~exist(opt.list{j},rawlist{i,1});
87+ opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2});
88 break
89 else
90 j=j+1;
91 end
92 end
93 if j>numberofplots,
94- disp(['plot info message: too many ''' rawoptions.list{i,1} ''' options']);
95+ disp(['plot info message: too many ''' rawlist{i,1} ''' options']);
96 end
97 end
98 end
Note: See TracBrowser for help on using the repository browser.