Home > functions > gui > bm_editor > bm_fileio > bm_fileio_write_head_file.m

bm_fileio_write_head_file

PURPOSE ^

write head file

SYNOPSIS ^

function [result] = bm_fileio_write_head_file(out_file,V_cell, F_cell, xx_cell,model_name_cell, conduct_cell);

DESCRIPTION ^

 write head file
 [USAGE]
    [result] = bm_fileio_write_head_file(
                <out_file>, <V_cell>, <F_cell>, <xx_cell>,
                <model_name_cell>, <conduct_cell>);
 [IN]
           out_file : output head file(fullpath)
             V_cell : cell array of vertex
             F_cell : cell array of face
            xx_cell : cell array of normal vector
    model_name_cell : cell array of model name
       conduct_cell : cell array of conductivity
 [OUT]
    result : file write result(SUCCESS or 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] = bm_fileio_write_head_file(out_file, ...
0002                                             V_cell, F_cell, xx_cell, ...
0003                                             model_name_cell, conduct_cell);
0004 % write head file
0005 % [USAGE]
0006 %    [result] = bm_fileio_write_head_file(
0007 %                <out_file>, <V_cell>, <F_cell>, <xx_cell>,
0008 %                <model_name_cell>, <conduct_cell>);
0009 % [IN]
0010 %           out_file : output head file(fullpath)
0011 %             V_cell : cell array of vertex
0012 %             F_cell : cell array of face
0013 %            xx_cell : cell array of normal vector
0014 %    model_name_cell : cell array of model name
0015 %       conduct_cell : cell array of conductivity
0016 % [OUT]
0017 %    result : file write result(SUCCESS or 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('out_file', 'var')
0026     error('out_file is a required parameter.');
0027 end
0028 if ~exist('V_cell', 'var')
0029     error('V_cell is a required parameter.');
0030 end
0031 if ~exist('F_cell', 'var')
0032     error('F_cell is a required parameter.');
0033 end
0034 if ~exist('xx_cell', 'var')
0035     error('xx_cell is a required parameter.');
0036 end
0037 if ~exist('model_name_cell', 'var')
0038     error('model_name_cell is a required parameter.');
0039 end
0040 if ~exist('conduct_cell', 'var')
0041     error('conduct_cell is a required parameter.');
0042 end
0043 
0044 %
0045 % --- Main Procedure
0046 %
0047 result = SUCCESS;
0048 % try
0049 %     Nmodel = length(V_cell)
0050 %     temp_head_file = cell(1, Nmodel);
0051 %
0052 %     for k=1:Nmodel
0053 %         Headinfo = [];
0054 %         Headinfo = vb_headinfo_make(Headinfo, V_cell{k}, F_cell{k}, xx_cell{k},...
0055 %                                  model_name_cell{k}, conduct_cell{k});
0056 %         [path_name, name, ext] = fileparts([tempname '.head.mat']);
0057 %         temp_head_file{k} = [name, ext];
0058 %         vb_headinfo_save(Headinfo, [path_name filesep temp_head_file{k}]);
0059 %     end
0060 %     [path_name, name, ext] = fileparts(temp_head_file{1});
0061 %     vb_util_join_head_files(temp_head_file, tempdir, out_file, ...
0062 %                         [], model_name_cell, [], [], 1);
0063 % catch
0064 %     result = FAILURE;
0065 % end
0066 
0067 try
0068     Nmodel = length(V_cell);
0069     temp_head_file = cell(1, Nmodel);
0070     Headinfo_list = [];
0071 
0072     for k=1:Nmodel
0073         Headinfo = [];
0074         Headinfo = vb_headinfo_make(Headinfo, V_cell{k}, F_cell{k}, xx_cell{k},...
0075                                  model_name_cell{k}, conduct_cell{k});
0076         Headinfo_list = [Headinfo_list; Headinfo];
0077     end
0078     % export
0079      vb_headinfo_join(Headinfo_list, out_file);
0080 catch
0081     result = FAILURE;
0082 end

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