Changeset 20132
- Timestamp:
- 02/11/16 19:36:12 (10 years ago)
- File:
- 
      - 1 edited
 
 - 
          
  issm/trunk-jpl/src/m/classes/pairoptions.m (modified) (1 diff)
 
Legend:
- Unmodified
- Added
- Removed
- 
      issm/trunk-jpl/src/m/classes/pairoptions.mr19040 r20132 219 219 end 220 220 end % }}} 221 function values = getfieldvalues(self,field,varargin), % {{{ 222 %GETOPTION - get the value of an option (if the option is repeated, return multiple values) 223 % 224 % Usage: 225 % values=getfieldvalues(self,field,varargin) 226 % 227 % Find all option values from a field. Default options 228 % can be given in input if the field does not exist 229 % 230 % Examples: 231 % values=getfieldvalue(options,'caxis'); 232 % values=getfieldvalue(options,'caxis',{[0 2],[3 4]}); 233 234 %some argument checking: 235 if nargin~=2 && nargin~=3, 236 help getfieldvalues 237 error('getfieldvalues error message: bad usage'); 238 end 239 240 if ~ischar(field), 241 error('getfieldvalues error message: field should be a string'); 242 end 243 244 %Recover options 245 pos=find(strcmpi(self.list(:,1),field)); 246 if ~isempty(pos), 247 values={}; 248 for i=1:length(pos), 249 values{i}=self.list{pos(i),2}; 250 self.list{pos(i),3}=true; % option used 251 end 252 return; 253 end 254 255 %The option has not been found, output default if provided 256 if nargin==3, 257 values=varargin{1}; 258 else 259 error(['error message: field ' field ' has not been provided by user (and no default value has been specified)']) 260 end 261 end % }}} 221 262 function self = removefield(self,field,warn)% {{{ 222 263 %REMOVEFIELD - delete a field in an option list 
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  ![(please configure the [header_logo] section in trac.ini)](/trac/issm/chrome/common/trac_banner.png)
