Changeset 2392


Ignore:
Timestamp:
10/08/09 09:00:37 (15 years ago)
Author:
Mathieu Morlighem
Message:

Added some useful routines in pairoptions

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 input
     1function pairoptions=buildlist(pairoptions,varargin),
     2%BUILDLIST - build list of pairoptions from input
    33%
    44%   Usage:
    5 %      options=buildlist(options,varargin)
     5%      pairoptions=buildlist(pairoptions,varargin)
    66
    77%check length of input
    88if 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')
    1010end
    1111
    12 %go through varargin and build list of options
     12%go through varargin and build list of pairoptions
    1313for i=1:(nargin-1)/2,
    1414        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};
    1717        else
    1818                %option is not a string, ignore it
    19                 disp(['pairoptions info: 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']);
    2020                continue
    2121        end
  • issm/trunk/src/m/classes/@pairoptions/display.m

    r2373 r2392  
    66disp(sprintf('\n%s = \n',inputname(1)));
    77disp(sprintf('   type: %s',pairoptions.type));
    8 disp(sprintf('   options: (%ix%i)',size(pairoptions.list,1),size(pairoptions.list,2)));
     8if ~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
     19else
     20        disp(sprintf('   list: empty'));
     21end
Note: See TracChangeset for help on using the changeset viewer.