Home > vbmeg > functions > tool_box > neuromag > neuromag_load_extra_data.m

neuromag_load_extra_data

PURPOSE ^

load extra channel data from fiffile.

SYNOPSIS ^

function [data, extra_info] = neuromag_load_extra_data(fiffile, index_in_fiffile)

DESCRIPTION ^

 load extra channel data from fiffile.
 [USAGE]
    [data] = neuromag_load_extra_data(<fiffile>);
 [IN]
                   fiffile : fiffile(Continuous file or Evoked file)
          index_in_fiffile : = -1 : continuous
                             =  N : data set number in fiffile.
 [OUT]
    data : The data of one channel in each row, a single time sample in
           each column. Units: SI units. fT/m for gradiometers, fT for
           magnetometers, V for electric 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:

SOURCE CODE ^

0001 function [data, extra_info] = neuromag_load_extra_data(fiffile, index_in_fiffile)
0002 % load extra channel data from fiffile.
0003 % [USAGE]
0004 %    [data] = neuromag_load_extra_data(<fiffile>);
0005 % [IN]
0006 %                   fiffile : fiffile(Continuous file or Evoked file)
0007 %          index_in_fiffile : = -1 : continuous
0008 %                             =  N : data set number in fiffile.
0009 % [OUT]
0010 %    data : The data of one channel in each row, a single time sample in
0011 %           each column. Units: SI units. fT/m for gradiometers, fT for
0012 %           magnetometers, V for electric channels.
0013 %
0014 % Copyright (C) 2011, ATR All Rights Reserved.
0015 % License : New BSD License(see VBMEG_LICENSE.txt)
0016 
0017 
0018 %
0019 % --- Previous check
0020 %
0021 if ~exist('fiffile', 'var')
0022     error('fiffile is a required parameter.');
0023 end
0024 if exist(fiffile, 'file') ~= 2
0025     error('fiffile:%s is not found.', fiffile);
0026 end
0027 if ~exist('index_in_fiffile', 'var')
0028     index_in_fiffile = -1; % continuous
0029 end
0030 
0031 
0032 %
0033 % --- Main Procedure
0034 %
0035 extra_info = neuromag_load_extra_info(fiffile);
0036 
0037 if index_in_fiffile == -1
0038     % load Continuous data
0039     raw  = fiff_setup_read_raw(fiffile);
0040     data = fiff_read_raw_segment(raw);
0041 else
0042     % load Evoked data
0043     raw  = fiff_read_evoked(fiffile, index_in_fiffile);
0044     data = raw.evoked.epochs;
0045 end
0046     
0047 extra_ix = [];
0048 for k=1:length(extra_info.Channel_name)
0049     channel_name = extra_info.Channel_name{k};
0050     extra_ix = [extra_ix; strmatch(channel_name, raw.info.ch_names, 'exact')];
0051 end
0052 data = data(extra_ix, :, :);

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