-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconvert_cursorStateStruct_indexable.m
More file actions
31 lines (25 loc) · 1.01 KB
/
convert_cursorStateStruct_indexable.m
File metadata and controls
31 lines (25 loc) · 1.01 KB
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
%% Convert the structure with all sessions, trials, sessions INTO a more indexable structure
% Converting the N x 2 structure to a more indexable structure: where the
% elements (matrices {4xT}) are indexed by 3 numbers:
% struct_state {SessionNum, task, trialNum}
struct_state = {};
ctr = 1;
trialNum = 1;
check = 1;
for sessionNum = 1:14
trialNum = 1;
for task = 1:8
trialNum = 1;
expression = sprintf('Session:%d.*task:%d',sessionNum, task);
check = regexp(stateData(ctr).trialId, expression);
%check = regexp(stateData(ctr).trialId, expression);
while (check == 1)
struct_state{sessionNum, task, trialNum} = stateData(ctr).cursorState;
ctr = ctr+1;
trialNum = trialNum + 1;
expression = sprintf('Session:%d.*task:%d',sessionNum, task);
check = regexp(stateData(ctr).trialId, expression);
end
end
end
save('stateData_1msbins_cursorState_organized.mat','struct_state','-v7.3');