Home > bml > sync > bml_raw2coord.m

bml_raw2coord

PURPOSE ^

BML_RAW2COORD returns the time coordinated of the raw

SYNOPSIS ^

function coord = bml_raw2coord(raw,trial_idx)

DESCRIPTION ^

 BML_RAW2COORD returns the time coordinated of the raw

 Use as 
  coord = bml_raw2coord(raw)
  coord = bml_raw2coord(raw,trial_idx)

 raw - FT_DATATYPE_RAW from which to extract coordinated
 trial_idx - integer index of the trial to extract. Defaults to 1. 

 The returned coord structure can be used in calls to bml_crop_idx

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function coord = bml_raw2coord(raw,trial_idx)
0002 
0003 % BML_RAW2COORD returns the time coordinated of the raw
0004 %
0005 % Use as
0006 %  coord = bml_raw2coord(raw)
0007 %  coord = bml_raw2coord(raw,trial_idx)
0008 %
0009 % raw - FT_DATATYPE_RAW from which to extract coordinated
0010 % trial_idx - integer index of the trial to extract. Defaults to 1.
0011 %
0012 % The returned coord structure can be used in calls to bml_crop_idx
0013 
0014 if ~exist('trial_idx','var')
0015   trial_idx = 1;
0016 end
0017 
0018 assert(all(ismember({'trial','time'},fields(raw))),"trial and time fields required in raw"); 
0019 assert(length(trial_idx)==1,"Single trial index required");
0020 
0021 if numel(raw.trial)<trial_idx
0022   warning("trial not present in raw");
0023 end
0024 
0025 coord=[];
0026 coord.s1=1;
0027 coord.s2=length(raw.time{trial_idx});
0028 coord.t1=raw.time{trial_idx}(1);
0029 coord.t2=raw.time{trial_idx}(end);
0030 coord.nSamples=length(raw.time{trial_idx});
0031 
0032 
0033

Generated on Tue 25-Sep-2018 10:08:19 by m2html © 2005