Home > vbmeg > functions > device > meg > yokogawa > vb_ykgwfile_load_header.m

vb_ykgwfile_load_header

PURPOSE ^

load header information from yokogawa file and update meg_info

SYNOPSIS ^

function [meg_info] = vb_ykgwfile_load_header(ykgwfile, meg_info)

DESCRIPTION ^

 load header information from yokogawa file and update meg_info

 [usage]
   [meg_info] = vb_ykgwfile_load_header(ykgwfile, meg_info)

 [input]
   ykgwfile : <required> <<file>> yokogawa data file path
   meg_info : <optional> <<struct>> MEG information which is updated
            :  if this is not specified or is empty, meg_info will be created
            :  newly.

 [output]
   meg_info : <<struct>> updated meg_info structure

 [note]
   See also
     vb_ykgwfile_load_acq_cond

 [history]
   2007-06-12 (Sako) initial version
   2008-03-12 (Sako) renewed according to the new specification
   2011-05-26 (Sako) modified according to the new data format

 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 [meg_info] = vb_ykgwfile_load_header(ykgwfile, meg_info)
0002 % load header information from yokogawa file and update meg_info
0003 %
0004 % [usage]
0005 %   [meg_info] = vb_ykgwfile_load_header(ykgwfile, meg_info)
0006 %
0007 % [input]
0008 %   ykgwfile : <required> <<file>> yokogawa data file path
0009 %   meg_info : <optional> <<struct>> MEG information which is updated
0010 %            :  if this is not specified or is empty, meg_info will be created
0011 %            :  newly.
0012 %
0013 % [output]
0014 %   meg_info : <<struct>> updated meg_info structure
0015 %
0016 % [note]
0017 %   See also
0018 %     vb_ykgwfile_load_acq_cond
0019 %
0020 % [history]
0021 %   2007-06-12 (Sako) initial version
0022 %   2008-03-12 (Sako) renewed according to the new specification
0023 %   2011-05-26 (Sako) modified according to the new data format
0024 %
0025 % Copyright (C) 2011, ATR All Rights Reserved.
0026 % License : New BSD License(see VBMEG_LICENSE.txt)
0027 
0028 % --- CHECK ARGUMENTS --- %
0029 if ~exist('ykgwfile', 'var'), ykgwfile = []; end
0030 if ~exist('meg_info', 'var'), meg_info = []; end
0031 [ykgwfile, meg_info, meg_id] = inner_check_arguments(ykgwfile, meg_info);
0032 
0033 % --- MAIN PROCEDURE --------------------------------------------------------- %
0034 %
0035 %
0036 % -- Data acquisition information
0037 %
0038 define = vb_define_coordinate;
0039 
0040 acq_cond = vb_ykgwfile_load_acq_cond(ykgwfile);
0041 
0042 % MEG
0043 meg_info.MEG_ID      = meg_id;
0044 meg_info.device      = 'YOKOGAWA';
0045 meg_info.coord_type  = define.COORDINATE_YOKOGAWA_RIGHT_M;
0046 
0047 % --- MEGinfo.acq_type
0048 meg_info = vb_meginfo_set_acqtype(meg_info, acq_cond);
0049 
0050 % --- update MEGinfo.acq_info
0051 meg_info = vb_meginfo_set_acqcond(meg_info, acq_cond);
0052 
0053 meg_info.Nsample     = acq_cond.frame_length;
0054 meg_info = vb_meginfo_set_pre_trigger(meg_info, acq_cond.pretrigger_length);
0055 meg_info.SampleFreq  = acq_cond.sample_rate;
0056 meg_info.Nrepeat     = acq_cond.num_epoch;
0057 
0058 Trial = [];
0059 for i_trial = 1:meg_info.Nrepeat
0060   Trial(i_trial).number = i_trial;
0061   Trial(i_trial).sample = 1:meg_info.Nsample;
0062 end
0063 meg_info.Trial = Trial';
0064 return;
0065 %
0066 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0067 
0068 % --- INNER FUNCTIONS -------------------------------------------------------- %
0069 %
0070 % --- inner_check_arguments()
0071 %
0072 function [ykgwfile, meg_info, meg_id] = ...
0073   inner_check_arguments(ykgwfile, meg_info)
0074 
0075 func_ = mfilename;
0076 if isempty(ykgwfile)
0077   error('(%s) ykgwfile is a required parameter', func_);
0078 end
0079 
0080 % check validity as a file
0081 if exist(ykgwfile, 'file') ~= 2
0082   error('(%s) cannot find yokogawa file : %s', func_, ykgwfile);
0083 end
0084 
0085 if isempty(meg_info)
0086 %   error('(%s) meg_info is a required parameter', func_);
0087 end
0088 
0089 % get MEG_ID
0090 [path, meg_id] = fileparts(ykgwfile);
0091 
0092 return;
0093 %
0094 % --- end of inner_check_arguments()
0095 %
0096 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0097 
0098 % --- END OF FILE --- %

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