Changeset 2392
- Timestamp:
- 10/08/09 09:00:37 (15 years ago)
- Location:
- issm/trunk/src/m/classes/@pairoptions
- Files:
-
- 3 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/m/classes/@pairoptions/buildlist.m
r2373 r2392 1 function options=buildlist(options,varargin),2 %BUILDLIST - build list of options from input1 function pairoptions=buildlist(pairoptions,varargin), 2 %BUILDLIST - build list of pairoptions from input 3 3 % 4 4 % Usage: 5 % options=buildlist(options,varargin)5 % pairoptions=buildlist(pairoptions,varargin) 6 6 7 7 %check length of input 8 8 if mod((nargin-1),2), 9 error('buildlist error message: an even number of options is required')9 error('buildlist error message: an even number of pairoptions is required') 10 10 end 11 11 12 %go through varargin and build list of options12 %go through varargin and build list of pairoptions 13 13 for i=1:(nargin-1)/2, 14 14 if ischar(varargin{2*i-1}), 15 options.list{end+1,1}=varargin{2*i-1};16 options.list{end,2}=varargin{2*i};15 pairoptions.list{end+1,1}=varargin{2*i-1}; 16 pairoptions.list{end,2}=varargin{2*i}; 17 17 else 18 18 %option is not a string, ignore it 19 disp([' pairoptionsinfo: option number ' num2str(i) ' is not a string, it will be ignored']);19 disp(['buildlist info: option number ' num2str(i) ' is not a string, it will be ignored']); 20 20 continue 21 21 end -
issm/trunk/src/m/classes/@pairoptions/display.m
r2373 r2392 6 6 disp(sprintf('\n%s = \n',inputname(1))); 7 7 disp(sprintf(' type: %s',pairoptions.type)); 8 disp(sprintf(' options: (%ix%i)',size(pairoptions.list,1),size(pairoptions.list,2))); 8 if ~isempty(pairoptions.list), 9 disp(sprintf(' list: (%ix%i)\n',size(pairoptions.list,1),size(pairoptions.list,2))); 10 for i=1:size(pairoptions.list,1), 11 if ischar(pairoptions.list{i,2}), 12 disp(sprintf(' field: %-10s value: ''%s''',pairoptions.list{i,1},pairoptions.list{i,2})); 13 elseif isnumeric(pairoptions.list{i,2}) & length(pairoptions.list{i,2})==1, 14 disp(sprintf(' field: %-10s value: %g',pairoptions.list{i,1},pairoptions.list{i,2})); 15 else 16 disp(sprintf(' field: %-10s value: (%ix%i)',pairoptions.list{i,1},size(pairoptions.list{i,2},1),size(pairoptions.list{i,2},2))); 17 end 18 end 19 else 20 disp(sprintf(' list: empty')); 21 end
Note:
See TracChangeset
for help on using the changeset viewer.