0001 function [big_trial,NSamp,Samp_Rate] = rd_meg_onechan(analog_chans,megfilename);
0002
0003
0004
0005
0006
0007
0008
0009 if nargin < 1
0010 error('what are the channels')
0011 end
0012
0013 if nargin < 2
0014 [fid,megfilename] = get_fid('rb');
0015 fclose(fid);
0016 end;
0017 meg_fid = open_file_w_byte_order(megfilename,1);
0018
0019 [version, NChan, NMeg, NEeg, NReference, NBad_Sensors, NTrigger, NResponse, NUtility, NAnalog, Samp_Rate, NData_Epoch, Names, NSamp, trigger, response, header_length] = rd_meg_hdr(meg_fid);
0020
0021 [meg_indices,meg_channels, bad_sensors,eeg_indices,eeg_channels,analog_indices,analog_channels,reference_indices,reference_channels] = parse_names(Names,NMeg,NEeg,NBad_Sensors,NAnalog,NReference);
0022
0023 numsamp = fix(NSamp/100)
0024 grabsamp = numsamp;
0025 Samp_Rate = fix(Samp_Rate);
0026 Epoch = numsamp/Samp_Rate;
0027 NSamp = 100*numsamp;
0028 big_trial = zeros(NSamp,size(analog_chans,2));
0029 grab_samp = numsamp;
0030
0031 for itrial = 1:100
0032 trialdata = rd_meg_allch(meg_fid,header_length,NChan,grabsamp);
0033 eeg_indices = [];
0034 eeg_channels = [];
0035 trialdata_ord = fix_trial_order(trialdata,meg_channels,meg_indices,eeg_channels,eeg_indices,analog_channels,analog_indices,reference_channels,reference_indices);
0036
0037
0038 big_trial((itrial-1)*grabsamp+1:itrial*grabsamp,1:size(analog_chans,2)) = trialdata_ord(:,analog_chans);
0039 end;
0040
0041 fclose('all')
0042 status = 1;
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060