-
Notifications
You must be signed in to change notification settings - Fork 1
/
Label_To_Sentence.m
42 lines (32 loc) · 1020 Bytes
/
Label_To_Sentence.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
%% Bad channels for 01 13 136
%Path = 'C:\Users\Colleen\Documents\Sentences\Sentences\'
Path = 'F:\Sentences\';
filename = [Path,'80Trials_SentenceMix.txt'];
fileID = fopen(filename,'r');
fclose(fileID);
SentenceMixed = readtable(filename,'ReadVariableNames', false)
SentenceMixed = table2cell(SentenceMixed);
Trial = 1
EventName = string({Events.label}');
EventNr_2 = strip(EventName, 'left','E');
EventNr = []
for i = 1:length(EventNr_2)
if contains(EventNr_2(i),'_')
tmp = split(EventNr_2(i),'_');
EventNr_2(i) = tmp(1)
end
EventNr(i) = str2num(EventNr_2(i));
end
EventNr = EventNr'
idx = length(EventName);
SentenceTrial = string([]);
tr = 1
for ii = 2 : 3 : idx-1
SentenceNr = EventNr(ii)
SentenceTrial(tr) = string(SentenceMixed(SentenceNr,1))
tr = tr+1
end
SentenceTrial = SentenceTrial'
disp(['Save Sentences'])
save('-v7.3',[Path,'Sentence_Mixed_Trial',num2str(Trial),'.txt'],'SentenceTrial');
%clear SentenceTrial