Changeset 11892
- Timestamp:
- 04/04/12 08:45:21 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/classes/plotoptions.m
r8372 r11892 48 48 end 49 49 50 % first: build a pairoptions out of varargin:50 %go through varargin and build list (like pairoptions) 51 51 rawoptions=pairoptions(varargin{:}); 52 numoptions = (nargin-1)/2; 53 rawlist=cell(numoptions,2); 54 for i=1:numoptions, 55 if ischar(varargin{2*i-1}), 56 rawlist{i,1}=varargin{2*i-1}; 57 rawlist{i,2}=varargin{2*i}; 58 else 59 %option is not a string, ignore it 60 disp(['WARNING: option number ' num2str(i) ' is not a string, it will be ignored']); 61 rawlist(i,:)=[]; 62 continue 63 end 64 end 52 65 53 66 %get figure number … … 72 85 73 86 %process plot options 74 for i=1:size(raw options.list,1),87 for i=1:size(rawlist,1), 75 88 76 89 %If alloptions flag has is on, apply to all plots 77 if (allflag & ~strcmpi(raw options.list{i,1},'data') & ~ismember('#',rawoptions.list{i,1})),90 if (allflag & ~strcmpi(rawlist{i,1},'data') & ~ismember('#',rawlist{i,1})), 78 91 for j=1:numberofplots, 79 opt.list{j}=addfield(opt.list{j},raw options.list{i,1},rawoptions.list{i,2});92 opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2}); 80 93 end 81 94 82 95 %option contains '#' 83 elseif ismember('#',raw options.list{i,1}),96 elseif ismember('#',rawlist{i,1}), 84 97 85 98 %get suplot(s) associated 86 string=strsplit(raw options.list{i,1},'#');99 string=strsplit(rawlist{i,1},'#'); 87 100 plotnums=string{end}; 88 101 field=string{1}; … … 102 115 elseif strcmpi(plotnum,'all'); 103 116 for j=1:numberofplots, 104 opt.list{j}=addfield(opt.list{j},field,raw options.list{i,2});117 opt.list{j}=addfield(opt.list{j},field,rawlist{i,2}); 105 118 end 106 119 … … 113 126 end 114 127 for j=nums(1):nums(2), 115 opt.list{j}=addfield(opt.list{j},field,raw options.list{i,2});128 opt.list{j}=addfield(opt.list{j},field,rawlist{i,2}); 116 129 end 117 130 … … 122 135 error(['opt error message: ' field ' cannot be assigned (' plotnum ' exceed maximum number of plot)']); 123 136 end 124 opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,raw options.list{i,2});137 opt.list{str2num(plotnum)}=addfield(opt.list{str2num(plotnum)},field,rawlist{i,2}); 125 138 end 126 139 end … … 132 145 j=1; 133 146 while (j<=numberofplots), 134 if ~exist(opt.list{j},raw options.list{i,1});135 opt.list{j}=addfield(opt.list{j},raw options.list{i,1},rawoptions.list{i,2});147 if ~exist(opt.list{j},rawlist{i,1}); 148 opt.list{j}=addfield(opt.list{j},rawlist{i,1},rawlist{i,2}); 136 149 break 137 150 else … … 140 153 end 141 154 if j>numberofplots, 142 disp(['plot info message: too many ''' raw options.list{i,1} ''' options']);155 disp(['plot info message: too many ''' rawlist{i,1} ''' options']); 143 156 end 144 157 end
Note:
See TracChangeset
for help on using the changeset viewer.