Home > atmlab > datasets > datasets.m

datasets

PURPOSE ^

list or add dataset

SYNOPSIS ^

function SS = datasets(varargin)

DESCRIPTION ^

 list or add dataset

 Returns a magic structure with all known datasets.

 When called with an argument, adds a dataset. Warning! The constructor of
 SatDataset takes care of the 'registration', and there should never be a
 need to call this function with any argument directly.

 There's also so

 When called with 2 and 1st argument is 'delete', deletes 2nd entry.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

datasets.m

SOURCE CODE ^

0001 function SS = datasets(varargin)
0002 
0003 % list or add dataset
0004 %
0005 % Returns a magic structure with all known datasets.
0006 %
0007 % When called with an argument, adds a dataset. Warning! The constructor of
0008 % SatDataset takes care of the 'registration', and there should never be a
0009 % need to call this function with any argument directly.
0010 %
0011 % There's also so
0012 %
0013 % When called with 2 and 1st argument is 'delete', deletes 2nd entry.
0014 
0015 % $Id: datasets.m 8354 2013-04-18 22:15:37Z gerrit $
0016 
0017 persistent S
0018 
0019 if isempty(S)
0020     S = struct();
0021 end
0022 
0023 narginchk(0, 2);
0024 
0025 switch nargin
0026     case 2
0027         
0028         if (strcmp(varargin{1}, 'delete'))
0029             S = rmfield(S, varargin{2}.name);
0030         else
0031             error(['atmlab:' mfilename ':invalid'], ...
0032                 'Invalid call sig. See help text.');
0033         end
0034         
0035     case 1
0036         
0037             if isequal(varargin{1}, '*')
0038                 SS = S;
0039                 return
0040             end
0041             if isfield(S, varargin{1}.name)
0042                 if S.(varargin{1}.name) == varargin{1}
0043                     warning(['atmlab:' mfilename], ...
0044                         'Dataset with name %s was already defined, equally', ...
0045                         varargin{1}.name);
0046                 else
0047                     error(['atmlab:' mfilename], ...
0048                         'Dataset with name %s already exists and is different', varargin{1}.name);
0049                 end
0050             end
0051             if varargin{1}.visible
0052                 S.(varargin{1}.name) = varargin{1};
0053             end
0054         
0055     case 0
0056         
0057         SS = dsmagic();
0058         update_dynamic_props(SS);
0059         
0060 end
0061 
0062 %SS = S;
0063 
0064 end

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005