Changeset 1151 for trunk/src/update_imadoc.m
- Timestamp:
- Jun 26, 2024, 6:37:49 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/update_imadoc.m
r1127 r1151 30 30 errormsg=''; 31 31 testappend=0; 32 %% backup the output file if it already exist, and read it 33 if exist(outputfile,'file')%=1 if the output file already exists, 0 else 34 testappend=1; 35 backupfile=outputfile; 36 t=xmltree(outputfile); %read the file 37 title=get(t,1,'name'); 38 if strcmp(title,'ImaDoc') 39 % testappend=1; 40 %rename the existing file for backup 41 testexist=2; 32 33 %% set the output xml file at the root, hide other existing xml files 34 dotchar=regexp(outputfile,'\.'); 35 for idot=1:numel(dotchar) 36 outputfile=[outputfile(1:dotchar(end-idot+1)-1) '.xml']; 37 if exist(outputfile,'file') 38 backupfile=outputfile; 39 testexist=2; 42 40 while testexist==2 43 41 backupfile=[backupfile '~']; … … 49 47 return 50 48 end 51 %if the xml file is ImaDoc 52 uid_calib=find(t,['ImaDoc/' StructName]); 53 if isempty(uid_calib) %if Struct does not already exists, create it 54 [t,uid_calib]=add(t,1,'element',StructName); 55 else %if Struct already exists, delete its content 56 uid_child=children(t,uid_calib); 57 t=delete(t,uid_child); 58 end 49 end 50 end 51 52 53 %% backup the output file if it already exist, and read it 54 if exist(outputfile,'file')%=1 if the output file already exists, 0 else 55 testappend=1; 56 t=xmltree(outputfile); %read the file 57 title=get(t,1,'name'); 58 if ~strcmp(title,'ImaDoc') 59 errormsg=[outputfile ' not appropriate for calibration']; 60 return 61 end 62 uid_calib=find(t,['ImaDoc/' StructName]); 63 if isempty(uid_calib) %if Struct does not already exists, create it 64 [t,uid_calib]=add(t,1,'element',StructName); 65 else %if Struct already exists, delete its content 66 uid_child=children(t,uid_calib); 67 t=delete(t,uid_child); 59 68 end 60 69 end
Note: See TracChangeset
for help on using the changeset viewer.