Home > functions > device > vb_msrmnt_get_sampling_frequency.m

vb_msrmnt_get_sampling_frequency

PURPOSE ^

return sampling frequency from measurement file

SYNOPSIS ^

function sampling_frequency = vb_msrmnt_get_sampling_frequency(measurement_file)

DESCRIPTION ^

 return sampling frequency from measurement file
 [usage]
   sampling_frequency = vb_msrmnt_get_sampling_frequency(measurement_file)
 [input]
   measurement_file : <required> measurement file path
                    :  e.g. EEG-MAT (.eeg.mat), MEG-MAT (.meg.mat)
 [output]
   sampling_frequency : sampling frequency
 [note]
   acceptable 'Measurement' are :
   'MEG', 'EEG'
 [history]
   2007-08-02 (Sako) initial version
   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 sampling_frequency = vb_msrmnt_get_sampling_frequency(measurement_file)
0002 % return sampling frequency from measurement file
0003 % [usage]
0004 %   sampling_frequency = vb_msrmnt_get_sampling_frequency(measurement_file)
0005 % [input]
0006 %   measurement_file : <required> measurement file path
0007 %                    :  e.g. EEG-MAT (.eeg.mat), MEG-MAT (.meg.mat)
0008 % [output]
0009 %   sampling_frequency : sampling frequency
0010 % [note]
0011 %   acceptable 'Measurement' are :
0012 %   'MEG', 'EEG'
0013 % [history]
0014 %   2007-08-02 (Sako) initial version
0015 %   2011-06-01 (Sako) converted return values of vb_load_device to upper case
0016 %
0017 % Copyright (C) 2011, ATR All Rights Reserved.
0018 % License : New BSD License(see VBMEG_LICENSE.txt)
0019 
0020 % --- CHECK ARGUMENTS --- %
0021 if ~exist('measurement_file', 'var') measurement_file = []; end;
0022 measurement_file = inner_check_arguments(measurement_file);
0023 
0024 % --- MAIN PROCEDURE --------------------------------------------------------- %
0025 %
0026 func_ = mfilename;
0027 sampling_frequency = [];
0028 
0029 [measurement] = vb_load_device(measurement_file);
0030 Measurement = upper(measurement);
0031 
0032 switch Measurement
0033   case  'MEG'
0034     sampling_frequency = vb_megfile_get_sampling_frequency(measurement_file);
0035   case  'EEG'
0036     sampling_frequency = vb_eegfile_get_sampling_frequency(measurement_file);
0037   otherwise
0038     error('(%s)unexpected Measurement type : %s', func_, Measurement);
0039 end
0040 %
0041 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0042 
0043 
0044 % --- INNER FUNCTIONS -------------------------------------------------------- %
0045 %
0046 % --- inner_check_arguments()
0047 %
0048 function measurement_file = inner_check_arguments(measurement_file)
0049 func_ = mfilename;
0050 if isempty(measurement_file)
0051   error('(%s)measurement_file is a required parameter', func_);
0052 end
0053 
0054 if exist(measurement_file, 'file') ~= 2
0055   error('(%s)cannot find measurement file : %s', func_, measurement_file);
0056 end
0057 return;
0058 %
0059 % --- end of inner_check_arguments()
0060 
0061 % --- END OF FILE --- %

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