Home > functions > gui > batch > batch_mgr > vb_batch_mgr_build_batch_file.m

vb_batch_mgr_build_batch_file

PURPOSE ^

Output batch file

SYNOPSIS ^

function [result, errmsg] =vb_batch_mgr_build_batch_file(obj, proj_info, output_file)

DESCRIPTION ^

 Output batch file
 [USAGE]
    [result, errmsg] = 
          vb_batch_mgr_build_batch_file(<obj>,<proj_info>,<output_file>);
 [IN]
            obj : vb_batch_mgr object
      proj_info : project information
                  .proj_name : project name
                  .proj_root : project root directory
                  .proj_file : project file
    output_file : batch output filename
 [OUT]
       result : <<consntant>> SUCCESS (SUCCESS.m)
                              FAILURE (FAILURE.m)
       errmsg : reason for FAILURE.

 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 [result, errmsg] = ...
0002                       vb_batch_mgr_build_batch_file(obj, proj_info, output_file)
0003 % Output batch file
0004 % [USAGE]
0005 %    [result, errmsg] =
0006 %          vb_batch_mgr_build_batch_file(<obj>,<proj_info>,<output_file>);
0007 % [IN]
0008 %            obj : vb_batch_mgr object
0009 %      proj_info : project information
0010 %                  .proj_name : project name
0011 %                  .proj_root : project root directory
0012 %                  .proj_file : project file
0013 %    output_file : batch output filename
0014 % [OUT]
0015 %       result : <<consntant>> SUCCESS (SUCCESS.m)
0016 %                              FAILURE (FAILURE.m)
0017 %       errmsg : reason for FAILURE.
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 %
0023 % --- Previous check
0024 %
0025 if ~exist('obj', 'var')
0026     error('obj is a required parameter.');
0027 end
0028 if ~exist('proj_info', 'var')
0029     error('proj_info is a required parameter.');
0030 end
0031 if ~exist('output_file', 'var')
0032     error('output_file is a required parameter.');
0033 end
0034 
0035 %
0036 % --- Main Procedure
0037 %
0038 
0039 result = SUCCESS;
0040 errmsg = 'Failed to save file.';
0041 
0042 % get parameter set
0043 ix_main_list = vb_batch_mgr_get_output_index_list(obj);
0044 Nset = length(ix_main_list);
0045 if Nset == 0
0046     result = FAILURE;
0047     errmsg = 'ID is not selected.';
0048     return;
0049 end
0050 
0051 %
0052 % --- Make Variable which is put into a batch file.
0053 %
0054 parm_set = cell(Nset, 1);
0055 for k=1:Nset
0056     ix_main = ix_main_list(k);
0057     parm_set{k,1} = vb_batch_mgr_get_parm_set(obj, ix_main);
0058 end
0059 
0060 s = struct;
0061 s.header.proj_name  = proj_info.proj_name;
0062 s.header.proj_root  = proj_info.proj_root;
0063 s.header.proj_file  = proj_info.proj_file;
0064 s.header.builder    = vb_batch_mgr_get_name(obj);
0065 s.parm_set      = parm_set;
0066 
0067 % save batch file
0068 try
0069     vb_save_struct(output_file, s);
0070 catch
0071     result = FAILURE;
0072     err = lasterror;
0073     errmsg = err.message;
0074 end

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