Home > functions > common > loadfunc > vb_load_megref_data.m

vb_load_megref_data

PURPOSE ^

returns REFFERENCE MAGNETO METER data in MEG

SYNOPSIS ^

function megref = vb_load_megref_data(megfile, newfile)

DESCRIPTION ^

 returns REFFERENCE MAGNETO METER data in MEG
 [usage]
   megref = vb_load_megref_data(megfile, newfile)
 [input]
   megfile : <required> <<file>> MEG-MAT file
   newfile : <optional> name of MEG-MAT file which will newly store loaded data
           :  [] if it is empty, new file is not created
 [output]
    megref : REFFERENCE MAGNETO METER data in MEG
 [note]
   @see vb_load_meg_data.m
   if megfile is SBI data file or EEG-MAT file, return empty
 [history]
   2007-07-23 (Sako) initial version
   2008-06-06 (Sako) modified using new vb_load_meg_data
   2011-06-01 (Sako) converted return values of vb_load_device to upper case

 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 megref = vb_load_megref_data(megfile, newfile)
0002 % returns REFFERENCE MAGNETO METER data in MEG
0003 % [usage]
0004 %   megref = vb_load_megref_data(megfile, newfile)
0005 % [input]
0006 %   megfile : <required> <<file>> MEG-MAT file
0007 %   newfile : <optional> name of MEG-MAT file which will newly store loaded data
0008 %           :  [] if it is empty, new file is not created
0009 % [output]
0010 %    megref : REFFERENCE MAGNETO METER data in MEG
0011 % [note]
0012 %   @see vb_load_meg_data.m
0013 %   if megfile is SBI data file or EEG-MAT file, return empty
0014 % [history]
0015 %   2007-07-23 (Sako) initial version
0016 %   2008-06-06 (Sako) modified using new vb_load_meg_data
0017 %   2011-06-01 (Sako) converted return values of vb_load_device to upper case
0018 %
0019 % Copyright (C) 2011, ATR All Rights Reserved.
0020 % License : New BSD License(see VBMEG_LICENSE.txt)
0021 
0022 % --- CHECK ARGUMENTS --- %
0023 if ~exist('megfile', 'var'), megfile = []; end
0024 if ~exist('newfile', 'var'), newfile = []; end
0025 [megfile, newfile] = inner_check_arguments(megfile, newfile);
0026 
0027 % --- MAIN PROCEDURE --------------------------------------------------------- %
0028 %
0029 func_ = mfilename;
0030 
0031 [measurement, device] = vb_load_device(megfile);
0032 Measurement = upper(measurement);
0033 Device = upper(device);
0034 
0035 megref = [];
0036 
0037 switch Measurement
0038   case  'MEG'
0039     switch  Device
0040       case  'SBI'
0041         warning('(%s)%s does not have any refference channels\n', ...
0042           func_, Device);
0043       case 'YOKOGAWA'
0044         const = vb_define_const;
0045         loadspec = const.DATA_TYPE_REFERENCE;
0046         megref = vb_load_meg_data(megfile, loadspec, newfile);
0047       otherwise
0048         warning('(%s)unknown Device : %s(%s)\n', func_, Device, Measurement);
0049         return;
0050     end
0051 
0052   case  'EEG'
0053     warning('(%s)%s of %s does not have eny refference channels\n', ...
0054       func_, Device, Measurement);
0055     return;
0056 %     error('(%s)unsuitable Measurement: %s', func_, Measurement);
0057     
0058   otherwise
0059     error('(%s)unknown Measurement : %s', Measurement);
0060 end
0061 
0062 return
0063 %
0064 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0065 
0066 % --- INNER FUNCTIONS -------------------------------------------------------- %
0067 %
0068 function [megfile, newfile] = inner_check_arguments(megfile, newfile)
0069 func_ = mfilename;
0070 if isempty(megfile)
0071   error('(%s)megfile is a required parameter', func_);
0072 end
0073 
0074 if exist(megfile, 'file') ~= 2
0075   error('(%s)cannot find megfile : %s', func_, megfile);
0076 end
0077 
0078 if isempty(newfile)
0079   % require no action
0080 end
0081 return;
0082 %
0083 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0084 
0085 % --- END OF FILE --- %

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