-
Notifications
You must be signed in to change notification settings - Fork 1
/
intra_probe.m
69 lines (49 loc) · 2.21 KB
/
intra_probe.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
61
62
63
64
65
66
67
68
function [ ] = intra_probe ( superaggregate, desired_emg_ch )
% INTRA_PROBE plots motor evoked potentials within a session, and performs
% statistics on the response
% First takes the desired sessions for input, all sessions within a
% superaggregate structure
% Then plots each trial in the session sequentially for manual validation (via
% PAS_validate_EMG_responses)
% Create an additional set of data WITHOUT BASELINE REMOVED
% Then take average of all trial 1s, trial 2, etc. and create a congregate
% structure (and corresponding curve)
% Then do Kolmogorov-Smirnov test to determine statistical deviation from a
% gaussian curve.
% Also plot and do analyses on baseline activity level.
num_sess = size(superaggregate, 2);
% averaged_trial_responses = superaggregate(session).evoked_collapsed_EMGs;
for session = 1:num_sess
% plot the mean rect EMG signal as function of trial number
number_of_trials = size(superaggregate(session).evoked_collapsed_EMGs, 1);
trial_index = 1:number_of_trials;
trial_index = trial_index';
figure
subplot(1,2,1);
bar(trial_index, superaggregate(session).evoked_collapsed_EMGs(:,desired_emg_ch));
xlabel('Trial Number'); ylabel('Mean Rectified EMG Signal (V)');
title('Trial Distribution');
legend(superaggregate(session).blockname);
% plot the associated EMGs which come with this session
subplot(1,2,2);
plot(superaggregate(session).time_axis, superaggregate(session).mean_collapsed_EMGs(:,desired_emg_ch));
xlabel('Time Relative to Stimulation (s)'); ylabel('Mean Rectified EMG Signal (V)');
title('Average EMG Curve');
% Construct a questdlg with three options
choice = MFquestdlg( [0.4, 0.3], 'Would you like to keep this session?', ...
'Session Validation', ...
'KEEP','DISCARD','KEEP');
sess_vector = ones(1,num_sess);
switch choice
case 'KEEP'
sprintf('Session KEPT');
case 'DISCARD'
sprintf('Session DISCARDED');
sess_vector(1,session) = 0;
case 'AUTO/Break'
break;
end
% validation subroutine allowing user to keep or discard the session
% for intra-session calculation
end
end