-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpsr_lfp_conversion.m
44 lines (35 loc) · 1.11 KB
/
psr_lfp_conversion.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
function [data,nBlocks] = psr_lfp_conversion(data)
% PSR_LFP_CONVERSION - Convert local field potential data format
%
% Syntax: [data,nBlocks] = psr_lfp_conversion(data)
%
% Inputs:
% data - Can be given as:
% (1) Single time-series with shape: [Number of channels x Number of data points]
% (2) A cell array of the matrix type given by (1)
% (3) Cell array of FieldTrip data structures
%
% Outputs:
% data - Data in format given by (2)
% nBlocks - Number of experimental blocks
% PASER: Processing and Analysis Schemes for Extracellular Recordings
% https://github.com/tbrouns/paser
% Author: Terence Brouns
% Radboud University, Neurophysiology Dept.
% E-mail address: [email protected]
% Date: 2018
%------------- BEGIN CODE --------------
if (iscell(data))
nBlocks = length(data);
else % Single time-series
data = {data};
nBlocks = 1;
end
% Check for FieldTrip, and do conversion if necessary
for iBlock = 1:nBlocks
if isfield(data{iBlock},'trial')
data{iBlock} = data{iBlock}.trial{1};
end
end
end
%------------- END OF CODE --------------