rd_onetr_allch
PURPOSE
trialdata = rd_onetr_allch(fileid, cell_data_offset, trial_num, nchan, npoints, seek_start, start_samp, stop_samp)
SYNOPSIS
function trialdata = rd_onetr_allch(fid, cell_data_offset, trial_num, nchan, npoints, seek_start, start_samp, stop_samp)
DESCRIPTION
CROSS-REFERENCE INFORMATION
This function calls:
This function is called by:
- load_egis_ave ave = load_egis_ave(fname);
- rd_onecell function [celldata] = rd_onecell_allchan(fid, fhdr, chdr, cellnum)
SOURCE CODE
0001 function trialdata = rd_onetr_allch(fid, cell_data_offset, trial_num, nchan, npoints, seek_start, start_samp, stop_samp)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 bytes_to_end_of_trial = 0;
0023
0024 if nargin <= 5
0025 trial_offset = cell_data_offset + (trial_num-1)*nchan*npoints*2;
0026 seek_start = 'bof';
0027 start_samp = 1; stop_samp = npoints;
0028 samp_offset = 0;
0029 elseif nargin == 6
0030 if seek_start == 'bof'
0031 trial_offset = cell_data_offset + (trial_num-1)*nchan*npoints*2;
0032 else
0033 trial_offset = 0;
0034 end
0035 start_samp = 1; stop_samp = npoints;
0036 samp_offset = 0;
0037 elseif nargin == 8
0038 if seek_start == 'bof'
0039 trial_offset = cell_data_offset + (trial_num-1)*nchan*npoints*2;
0040 else
0041 trial_offset = 0;
0042 end
0043 samp_offset = (start_samp - 1)*nchan*2;
0044 bytes_to_end_of_trial = (npoints - stop_samp)*nchan*2;
0045 end
0046
0047 nsamps = stop_samp - start_samp + 1;
0048
0049 fseek(fid, trial_offset + samp_offset, seek_start);
0050
0051 trialdata = fread(fid, [nchan, nsamps],'int16');
0052
0053
0054
0055
0056
0057
0058 fseek(fid, bytes_to_end_of_trial, 'cof');
0059
0060 trialdata = trialdata';
Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003