Home > vbmeg > functions > device > vb_info_make_channel_info.m

vb_info_make_channel_info

PURPOSE ^

make channel info data from MEGinfo or EEGinfo which has not ChannelInfo field

SYNOPSIS ^

function [ch_info] = vb_info_make_channel_info(info, measurement)

DESCRIPTION ^

 make channel info data from MEGinfo or EEGinfo which has not ChannelInfo field
 [usage]
   [ch_info] = vb_info_make_channel_info(info, measurement)
 [input]
   info : <required> <<struct>> MEGinfo or EEGinfo
   measurement : <required> 'MEG' or 'EEG'
               :  case-insensitive
 [output]
   ch_info : <<struct>> fields are as follows:
           :  .Active <-- info.ActiveChannel
           :  .Name   <-- MEGinfo.MEGch_name, EEGinfo.ChannelName
           :  .ID     <-- MEGinfo.MEGch_id,   EEGinfo.ChannelID
           :  .Type   <-- []
 [note]

 [history]
   2009-08-19 (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 [ch_info] = vb_info_make_channel_info(info, measurement)
0002 % make channel info data from MEGinfo or EEGinfo which has not ChannelInfo field
0003 % [usage]
0004 %   [ch_info] = vb_info_make_channel_info(info, measurement)
0005 % [input]
0006 %   info : <required> <<struct>> MEGinfo or EEGinfo
0007 %   measurement : <required> 'MEG' or 'EEG'
0008 %               :  case-insensitive
0009 % [output]
0010 %   ch_info : <<struct>> fields are as follows:
0011 %           :  .Active <-- info.ActiveChannel
0012 %           :  .Name   <-- MEGinfo.MEGch_name, EEGinfo.ChannelName
0013 %           :  .ID     <-- MEGinfo.MEGch_id,   EEGinfo.ChannelID
0014 %           :  .Type   <-- []
0015 % [note]
0016 %
0017 % [history]
0018 %   2009-08-19 (Sako) initial version
0019 %
0020 % Copyright (C) 2011, ATR All Rights Reserved.
0021 % License : New BSD License(see VBMEG_LICENSE.txt)
0022 
0023 % --- CHECK ARGUMENTS --- %
0024 if ~exist('info', 'var'), info = []; end
0025 if ~exist('measurement', 'var'), measurement = ''; end
0026 [info, measurement] = inner_check_arguments(info, measurement);
0027 
0028 % --- MAIN PROCEDURE --------------------------------------------------------- %
0029 %
0030 % --- initialize
0031 ch_info.Active = [];
0032 ch_info.Name   = [];
0033 ch_info.ID     = [];
0034 ch_info.Type   = [];
0035 
0036 if isfield(info, 'ActiveChannel')
0037   ch_info.Active = info.ActiveChannel;
0038 end
0039 
0040 switch measurement
0041   case 'MEG'
0042     if isfield(info, 'MEGch_name')
0043       ch_info.Name = info.MEGch_name;
0044     end
0045     
0046     if isfield(info, 'MEGch_id')
0047       ch_info.ID = info.MEGch_id;
0048     end
0049 
0050   case 'EEG'
0051     if isfield(info, 'ChannelName')
0052       ch_info.Name = info.ChannelName;
0053     end
0054     
0055     if isfield(info, 'ChannelID')
0056       ch_info.ID = info.ChannelID;
0057     end
0058   otherwise
0059 end
0060 return;
0061 %
0062 % --- END OF MAIN PROCEDURE -------------------------------------------------- %
0063 
0064 % --- INNER FUNCTIONS -------------------------------------------------------- %
0065 %
0066 % --- inner_check_arguments()
0067 %
0068 function [info, measurement] = inner_check_arguments(info, measurement)
0069 func_ = mfilename;
0070 
0071 if isempty(info)
0072   error('(%s) info is a required parameter', func_);
0073 end
0074 
0075 if isempty(measurement)
0076   error('(%s) measurement is a required parameter', func_);
0077 end
0078 
0079 measurement = upper(measurement);
0080 return;
0081 %
0082 % --- end of inner_check_arguments()
0083 %
0084 % --- END OF INNER FUNCTIONS ------------------------------------------------- %
0085 
0086 % --- END OF FILE --- %

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