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

vb_meg_yokogawa_separate_data

PURPOSE ^

separate original data to MEG data, EXTRA data and REFMG data

SYNOPSIS ^

function [megdata, extdata, refdata, meg_info] =vb_meg_yokogawa_separate_data(orgdata, meg_info)

DESCRIPTION ^

 separate original data to MEG data, EXTRA data and REFMG data
 [usage]
   [megdata, exdata, meg_info] = ...
      vb_meg_yokogawa_separate_data(megdata, meg_info)
 [input]
    orgdata : <required> acquired data which include MEG, EXTRA, REFMG data
   meg_info : <required> <<struct>> MEGinfo
 [output]
    megdata : MEG data which was acquired by MEG channels
    extdata : extra data which was acquired by EXTRA channels
    refdata : reference magnetometer data
   meg_info : <<struct>> updated MEG
 [note]
   acquired data (:,1,:) is sample number
 [history]
   2007-07-03 (Sako) initial version
   2008-02-08 (Sako) modified thoroughly according to new specification
   2009-07-14 (Sako) modified to arrange by the order of imported channels

 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 [megdata, extdata, refdata, meg_info] = ...
0002   vb_meg_yokogawa_separate_data(orgdata, meg_info)
0003 % separate original data to MEG data, EXTRA data and REFMG data
0004 % [usage]
0005 %   [megdata, exdata, meg_info] = ...
0006 %      vb_meg_yokogawa_separate_data(megdata, meg_info)
0007 % [input]
0008 %    orgdata : <required> acquired data which include MEG, EXTRA, REFMG data
0009 %   meg_info : <required> <<struct>> MEGinfo
0010 % [output]
0011 %    megdata : MEG data which was acquired by MEG channels
0012 %    extdata : extra data which was acquired by EXTRA channels
0013 %    refdata : reference magnetometer data
0014 %   meg_info : <<struct>> updated MEG
0015 % [note]
0016 %   acquired data (:,1,:) is sample number
0017 % [history]
0018 %   2007-07-03 (Sako) initial version
0019 %   2008-02-08 (Sako) modified thoroughly according to new specification
0020 %   2009-07-14 (Sako) modified to arrange by the order of imported channels
0021 %
0022 % Copyright (C) 2011, ATR All Rights Reserved.
0023 % License : New BSD License(see VBMEG_LICENSE.txt)
0024 
0025 % --- CHECK ARGUMENTS --- %
0026 if ~exist('orgdata', 'var'), orgdata = []; end
0027 if ~exist('meg_info', 'var'), meg_info = []; end
0028 [orgdata, meg_info] = inner_check_arguments(orgdata, meg_info);
0029 
0030 % --- MAIN PROCEDURE --------------------------------------------------------- %
0031 %
0032 if isempty(orgdata)
0033   return;
0034 end
0035 
0036 org_label = orgdata(:,1,1);
0037 
0038 meg_ch_label_str = vb_meginfo_get_channel_label_meg(meg_info);
0039 meg_ch_label = str2double(meg_ch_label_str);
0040 [tmp_idx, meg_ch_idx] = vb_util_get_index(meg_ch_label, org_label);
0041 megdata = orgdata(meg_ch_idx, 2:end, :);
0042 
0043 ext_ch_label_str = vb_meginfo_get_channel_label_extra(meg_info);
0044 ext_ch_label = str2double(ext_ch_label_str);
0045 [tmp_idx, ext_ch_idx] = vb_util_get_index(ext_ch_label, org_label);
0046 extdata = orgdata(ext_ch_idx, 2:end, :);
0047 
0048 ref_ch_label_str = vb_meginfo_get_channel_label_refmg(meg_info);
0049 ref_ch_label = str2double(ref_ch_label_str);
0050 [tmp_idx, ref_ch_idx] = vb_util_get_index(ref_ch_label, org_label);
0051 refdata = orgdata(ref_ch_idx, 2:end, :);
0052 
0053 % added field to meginfo
0054 meg_info.MEGch_id = meg_ch_idx;
0055 return;
0056 %
0057 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0058 
0059 % --- INNER FUNCTIONS -------------------------------------------------------- %
0060 %
0061 % --- inner_check_arguments()
0062 %
0063 function [bexp, meg_info] = inner_check_arguments(bexp, meg_info)
0064 func_ = mfilename;
0065 
0066 if isempty(meg_info)
0067   error('(%s)meg_info is a required parameter', func_);
0068 end
0069 
0070 if isempty(bexp)
0071   % require no action
0072 end
0073 return;
0074 %
0075 % --- end of inner_check_arguments()
0076 %
0077 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0078 
0079 %%% END OF FILE %%%

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