0001 function project_mgr_output_history(fig)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0017 error('invalid figure handle is specified.');
0018 end
0019
0020
0021
0022
0023
0024 data = guidata(fig);
0025 H = data.H;
0026
0027 h = file_dialog;
0028 project_root = get(H.project_root_edit, 'String');
0029 h = set(h, 'current_dir', project_root);
0030 h = set(h, 'file_extensions', {'.txt'});
0031 h = set(h, 'save_mode', 1);
0032
0033
0034 history_file = [];
0035 [dir_name, fnames] = visible(h);
0036 if ~isempty(dir_name) && ~isempty(fnames{1})
0037 history_file = [dir_name, filesep, fnames{1}];
0038 else
0039 return;
0040 end
0041
0042
0043 [all_parms, parm_types] = project_file_mgr('get_all_parameters');
0044 Nparm = length(all_parms);
0045
0046
0047 fid = fopen(history_file, 'w');
0048 if fid == -1, return; end;
0049 for k=1:Nparm
0050 parm_str = vb_struct2str(all_parms{k});
0051 fprintf(fid, '------------------------------------\n');
0052 fprintf(fid, '%s (%s)\n', parm_types{k}, all_parms{k}.time_stamp);
0053 fprintf(fid, '------------------------------------\n');
0054 for j=1:length(parm_str)
0055 if findstr('time_stamp', parm_str{j})
0056 continue;
0057 else
0058 fprintf(fid, '%s\n', parm_str{j});
0059 end
0060 end
0061 fprintf(fid, '\n\n');
0062 end
0063 fclose(fid);