-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathperceive_plot_raw_signals.m
60 lines (53 loc) · 1.56 KB
/
perceive_plot_raw_signals.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
function [raw,time,chanlabels,p]=perceive_plot_raw_signals(data,chanlabels,time)
if ~exist('data','var') || isempty(data)
[files,path] = uigetfile('*.mat','Select exported Percept FieldTrip .mat file','MultiSelect','on');
files = strcat(path,files);
else
files = data;
end
for a=1:length(files)
if iscell(files)
load(files{a})
end
if isstruct(data)
if isfield(data,'realtime')
if iscell(data.realtime)
time = data.realtime{1};
else
time = data.realtime;
end
else
time = data.time{1};
end
chanlabels = data.label;
fname = data.fname;
fs = data.fsample;
raw = data.trial{1};
else
raw = data;
fname = '';
fs = 250;
if ~exist('time','var') || isempty(time)
time = linspace(0,length(data)/fs,length(data));
end
end
if ~exist('chanlabels','var')
for a = 1:size(data,1)
chanlabels{a} = ['chan' num2str(a)];
end
end
raw(isnan(raw))=0;
figure('Units','centimeters','PaperUnits','centimeters','Position',[1 1 40 20])
for b = 1:size(raw,1)
p(b)=plot(time,zscore(raw(b,:)')'./10+b);
hold on
end
set(gca,'YTick',[1:size(raw,1)],'YTickLabel',strrep(chanlabels,'_',' '),'YTickLabelRotation',45);
xlabel('Time')
ylabel('Amplitude')
if length(time)>1
xlim([time(1) time(end)]);
end
ylim([0 length(chanlabels)+1]);
title(strrep(fname,'_',' '))
end