Home > vbmeg > functions > common > loadfunc > vb_load_channel.m

vb_load_channel

PURPOSE ^

This function returns channel coordinate value for plot

SYNOPSIS ^

function [pos, channel_info] = vb_load_channel(megfile, active_swt)

DESCRIPTION ^

 This function returns channel coordinate value for plot
 [usage]
   [pos, channel_info] = vb_load_channel(megfile, active_swt)
 [input]
      megfile : <required> <<file>> MEG/EEG-MAT file
   active_swt : <optional> <<boolean>> active switch [true]
              :   true) return only active channels
              :  false) return all then channels
 [output]
            pos : 3D-coordinate of channel position [Nchannel x 3]
   channel_info : <<struct>> channel information of loaded channel.
                :  .Active [Nchannel x 1]
                :  .Name   [Nchannel x 1]
                :  .Type   [Nchannel x 1]
                :  .ID     [Nchannel x 1]
 [note]
   does not check parameter
 [history]
   2007-8-23 Masa-aki Sato
   2008-04-16 (Sako) added active_swt
   2011-08-31 (Sako) modified how to call vb_load_sensor
   2017-11-22 rhayashi
    return central coordinate value of coils as channel position.
   2018-08-23 (Takeda) removed ch_indx to make code simple

 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:

SOURCE CODE ^

0001 function    [pos, channel_info] = vb_load_channel(megfile, active_swt)
0002 % This function returns channel coordinate value for plot
0003 % [usage]
0004 %   [pos, channel_info] = vb_load_channel(megfile, active_swt)
0005 % [input]
0006 %      megfile : <required> <<file>> MEG/EEG-MAT file
0007 %   active_swt : <optional> <<boolean>> active switch [true]
0008 %              :   true) return only active channels
0009 %              :  false) return all then channels
0010 % [output]
0011 %            pos : 3D-coordinate of channel position [Nchannel x 3]
0012 %   channel_info : <<struct>> channel information of loaded channel.
0013 %                :  .Active [Nchannel x 1]
0014 %                :  .Name   [Nchannel x 1]
0015 %                :  .Type   [Nchannel x 1]
0016 %                :  .ID     [Nchannel x 1]
0017 % [note]
0018 %   does not check parameter
0019 % [history]
0020 %   2007-8-23 Masa-aki Sato
0021 %   2008-04-16 (Sako) added active_swt
0022 %   2011-08-31 (Sako) modified how to call vb_load_sensor
0023 %   2017-11-22 rhayashi
0024 %    return central coordinate value of coils as channel position.
0025 %   2018-08-23 (Takeda) removed ch_indx to make code simple
0026 %
0027 % Copyright (C) 2011, ATR All Rights Reserved.
0028 % License : New BSD License(see VBMEG_LICENSE.txt)
0029 
0030 if ~exist('active_swt', 'var')
0031     active_swt = true;
0032 end
0033 
0034 [pick, Qpick, CoilWeight, Vcenter, result, channel_info] = vb_load_sensor(megfile, '', '', active_swt);
0035 
0036 %  CoilWeight(m,n) : n-th coil weight for m-th channel [Nchannel x Ncoil]
0037 
0038 if isempty(CoilWeight)
0039     pos = pick;
0040 else
0041     Nch = size(CoilWeight, 1);
0042     pos = zeros(Nch,3);
0043     for n=1:Nch
0044         pos(n,:) = mean(pick(CoilWeight(n, :) ~= 0, :), 1);
0045     end
0046 end
0047 
0048 % --- END OF FILE --- %

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