Home > functions > gui > project_mgr_dir > project_mgr_output_history.m

project_mgr_output_history

PURPOSE ^

output parameter list by text file

SYNOPSIS ^

function project_mgr_output_history(fig)

DESCRIPTION ^

 output parameter list by text file
 [USAGE]
    project_mgr_output_history(<fig>);
 [IN]
    fig : figure handle of proeject_mgr gui.
 [OUT]
    none

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function project_mgr_output_history(fig)
0002 % output parameter list by text file
0003 % [USAGE]
0004 %    project_mgr_output_history(<fig>);
0005 % [IN]
0006 %    fig : figure handle of proeject_mgr gui.
0007 % [OUT]
0008 %    none
0009 %
0010 % Copyright (C) 2011, ATR All Rights Reserved.
0011 % License : New BSD License(see VBMEG_LICENSE.txt)
0012 
0013 %
0014 % --- Previous check
0015 %
0016 if ~exist('fig', 'var') || isempty(fig) || ~ishandle(fig)
0017     error('invalid figure handle is specified.');
0018 end
0019 
0020 %
0021 % --- Main Procedure
0022 %
0023 % load data (@see project_mgr)
0024 data = guidata(fig);
0025 H = data.H; % component handles
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 % get text filename
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 % get all parameters
0043 [all_parms, parm_types] = project_file_mgr('get_all_parameters');
0044 Nparm = length(all_parms);
0045 
0046 % output text file
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);

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005