Home > vbmeg > functions > leadfield > head > vb_headinfo_make.m

vb_headinfo_make

PURPOSE ^

make or update Headinfo struct

SYNOPSIS ^

function Headinfo = vb_headinfo_make(Headinfo,Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex)

DESCRIPTION ^

 make or update Headinfo struct
 [usage]
   Headinfo = vb_headinfo_make(Headinfo,
     Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex)
 [input]
   Headinfo : <required> exist Headinfo. empty is O.K.
            :  If it is empty, new Headinfo struct will be created.
            :  If it is NOT empty, given Headinfo will be updated.
      Vhead : <required> empty is O.K. 
      Fhead : <required> empty is O.K.
     XXhead : <required> empty is O.K.
   LayerTag : <required> empty is O.K.
      Sigma : <required> empty is O.K.
    Rmethod : <required> empty is O.K.
          R : <required> empty is O.K.
     Npatch : <required> empty is O.K.
    Nvertex : <required> empty is O.K.
 [output]
   Headinfo : <<struct>>
            : (e.g.)
            :      Vhead: [3774x3 double]
            :      Fhead: [7536x3 double]
            :     XXhead: [3774x3 double]
            :   LayerTag: [3x5 char]
            :      Sigma: [0.62 0.03 0.62]
            :    Rmethod: 'MEAN'
            :          R: [0.0770 0.0828 0.0932]
            :     Npatch: [3x2 double]
            :    Nvertex: [3x2 double]

 [note]

 [history]
   2007-04-06 (Sako) initial version

 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:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function Headinfo = vb_headinfo_make(Headinfo, ...
0002   Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex)
0003 % make or update Headinfo struct
0004 % [usage]
0005 %   Headinfo = vb_headinfo_make(Headinfo,
0006 %     Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex)
0007 % [input]
0008 %   Headinfo : <required> exist Headinfo. empty is O.K.
0009 %            :  If it is empty, new Headinfo struct will be created.
0010 %            :  If it is NOT empty, given Headinfo will be updated.
0011 %      Vhead : <required> empty is O.K.
0012 %      Fhead : <required> empty is O.K.
0013 %     XXhead : <required> empty is O.K.
0014 %   LayerTag : <required> empty is O.K.
0015 %      Sigma : <required> empty is O.K.
0016 %    Rmethod : <required> empty is O.K.
0017 %          R : <required> empty is O.K.
0018 %     Npatch : <required> empty is O.K.
0019 %    Nvertex : <required> empty is O.K.
0020 % [output]
0021 %   Headinfo : <<struct>>
0022 %            : (e.g.)
0023 %            :      Vhead: [3774x3 double]
0024 %            :      Fhead: [7536x3 double]
0025 %            :     XXhead: [3774x3 double]
0026 %            :   LayerTag: [3x5 char]
0027 %            :      Sigma: [0.62 0.03 0.62]
0028 %            :    Rmethod: 'MEAN'
0029 %            :          R: [0.0770 0.0828 0.0932]
0030 %            :     Npatch: [3x2 double]
0031 %            :    Nvertex: [3x2 double]
0032 %
0033 % [note]
0034 %
0035 % [history]
0036 %   2007-04-06 (Sako) initial version
0037 %
0038 % Copyright (C) 2011, ATR All Rights Reserved.
0039 % License : New BSD License(see VBMEG_LICENSE.txt)
0040 
0041 % --- CHECK ARGUMENTS --- %
0042 if ~exist('Vhead', 'var')    Vhead = []; end;
0043 if ~exist('Fhead', 'var')    Fhead = []; end;
0044 if ~exist('XXhead', 'var')   XXhead = []; end;
0045 if ~exist('LayerTag', 'var') LayerTag = []; end;
0046 if ~exist('Sigma', 'var')    Sigma = []; end;
0047 if ~exist('Rmethod', 'var')  Rmethod = []; end;
0048 if ~exist('R', 'var')        R = []; end;
0049 if ~exist('Npatch', 'var')   Npatch = []; end;
0050 if ~exist('Nvertex', 'var')  Nvertex = []; end;
0051 
0052 [Headinfo, Vhead, Fhead, XXhead, ...
0053     LayerTag, Sigma, Rmethod, R, Npatch, Nvertex] = ...
0054   inner_check_arguments( Headinfo, ...
0055     Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex);
0056 
0057 % --- MAIN PROCEDURE --------------------------------------------------------- %
0058 %
0059 if isempty(Headinfo)
0060   % create or reset new Headinfo
0061   Headinfo = vb_headinfo_set_vhead(Headinfo,Vhead);
0062   Headinfo = vb_headinfo_set_fhead(Headinfo,Fhead);
0063   Headinfo = vb_headinfo_set_xxhead(Headinfo,XXhead);
0064   Headinfo = vb_headinfo_set_layertag(Headinfo,LayerTag);
0065   Headinfo = vb_headinfo_set_sigma(Headinfo,Sigma);
0066   Headinfo = vb_headinfo_set_rmethod(Headinfo,Rmethod);
0067   Headinfo = vb_headinfo_set_radius(Headinfo,R);
0068   Headinfo = vb_headinfo_set_npatch(Headinfo,Npatch);
0069   Headinfo = vb_headinfo_set_nvertex(Headinfo,Nvertex);
0070   
0071 else
0072 
0073   % update data which is specified
0074   if ~isempty(Vhead)
0075     Headinfo = vb_headinfo_set_vhead(Headinfo,Vhead); end;
0076   if ~isempty(Fhead)
0077     Headinfo = vb_headinfo_set_fhead(Headinfo,Fhead); end;
0078   if ~isempty(XXhead)
0079     Headinfo = vb_headinfo_set_xxhead(Headinfo,XXhead); end;
0080   if ~isempty(LayerTag)
0081     Headinfo = vb_headinfo_set_layertag(Headinfo,LayerTag); end;
0082   if ~isempty(Sigma)
0083     Headinfo = vb_headinfo_set_sigma(Headinfo,Sigma); end;
0084   if ~isempty(Rmethod)
0085     Headinfo = vb_headinfo_set_rmethod(Headinfo,Rmethod); end;
0086   if ~isempty(R)
0087     Headinfo = vb_headinfo_set_radius(Headinfo,R); end;
0088   if ~isempty(Npatch)
0089     Headinfo = vb_headinfo_set_npatch(Headinfo,Npatch); end;
0090   if ~isempty(Nvertex)
0091     Headinfo = vb_headinfo_set_nvertex(Headinfo,Nvertex); end;
0092 end
0093 %
0094 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0095 
0096 % --- INNER FUNCTIONS -------------------------------------------------------- %
0097 %
0098 function [Headinfo, Vhead, Fhead, XXhead, ...
0099   LayerTag, Sigma, Rmethod, R, Npatch, Nvertex] = ...
0100   inner_check_arguments( Headinfo, ...
0101     Vhead, Fhead, XXhead, LayerTag, Sigma, Rmethod, R, Npatch, Nvertex)
0102 
0103 % especially do nothing for now
0104 % if you want to set default value, you can do it here.
0105 % (e.g.)
0106 %  if isempty(Vhead) Vhead = [0 0 0]; end;
0107 
0108 return;
0109 %
0110 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0111 
0112 %%% END OF FILE %%%

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005