Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of edl_updatectrlfile
Home > sltoolbox > ExpDL > edl_updatectrlfile.m

edl_updatectrlfile

PURPOSE ^

EDL_UPDATECTRLFILE Updates the status in a control file

SYNOPSIS ^

function edl_updatectrlfile(guid, filename, idx, status)

DESCRIPTION ^

EDL_UPDATECTRLFILE Updates the status in a control file

 $ Syntax $
   - edl_updatectrlfile(guid, filename, idx, status)

 $ Arguments $
   - guid:         the expecting GUID of the control file
   - filename:     the filename of the control file
   - idx:          the internal index of the entry to be updated
   - status:       the updated status

 $ Description $
   - edl_updatectrlfile(guid, filename, idx, status) updates a specified
     entry of a control file.

 $ History $
   - Created by Dahua Lin, on Aug 14, 2006

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
  • edl_batchexp EDL_BATCHEXP Performs Batch experiments according to scheme

SOURCE CODE ^

0001 function edl_updatectrlfile(guid, filename, idx, status)
0002 %EDL_UPDATECTRLFILE Updates the status in a control file
0003 %
0004 % $ Syntax $
0005 %   - edl_updatectrlfile(guid, filename, idx, status)
0006 %
0007 % $ Arguments $
0008 %   - guid:         the expecting GUID of the control file
0009 %   - filename:     the filename of the control file
0010 %   - idx:          the internal index of the entry to be updated
0011 %   - status:       the updated status
0012 %
0013 % $ Description $
0014 %   - edl_updatectrlfile(guid, filename, idx, status) updates a specified
0015 %     entry of a control file.
0016 %
0017 % $ History $
0018 %   - Created by Dahua Lin, on Aug 14, 2006
0019 %
0020 
0021 %% parse and verify input
0022 if nargin < 4
0023     raise_lackinput('edl_updatectrlfile', 4);
0024 end
0025 
0026 %% read and verify
0027 
0028 C = edl_readctrlfile(filename);
0029 
0030 if ~strcmpi(C.guid, guid)
0031     error('edl:interperror', ...
0032         'Inconsistent between the GUID of control file and script on %s', filename);
0033 end
0034 
0035 %% update
0036 
0037 n = length(C.status);
0038 if idx > length(C.status)
0039     error('edl:interperror', ...
0040         'The index is beyond the number of entries on %s', filename);
0041 end
0042 
0043 if ~ismember(status, {'pending', 'succeed', 'failed'})
0044     error('edl:interperror', ...
0045         'Invalid status for control file: %s', status);
0046 end
0047 
0048 C.status{idx} = status;
0049 
0050 %% write
0051 
0052 
0053 doctag = 'ExpControl';
0054 attribs.guid = guid;
0055 nodetag = 'Entry';
0056 
0057 props = struct(...
0058     'internal_index', cell(n, 1), ...
0059     'status', cell(n, 1) ...
0060     );
0061 for i = 1 : n
0062     props(i).internal_index = i;
0063     props(i).status = C.status{i};
0064 end
0065 
0066 
0067 % backup first
0068 copyfile(filename, [filename, '.bak']);
0069 edl_writeprops(doctag, attribs, nodetag, props, filename);
0070 
0071 
0072 
0073 
0074

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com