0001 function edl_updatectrlfile(guid, filename, idx, status)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 if nargin < 4
0023 raise_lackinput('edl_updatectrlfile', 4);
0024 end
0025
0026
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
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
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
0068 copyfile(filename, [filename, '.bak']);
0069 edl_writeprops(doctag, attribs, nodetag, props, filename);
0070
0071
0072
0073
0074