-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenPlot.m
More file actions
73 lines (48 loc) · 2.11 KB
/
openPlot.m
File metadata and controls
73 lines (48 loc) · 2.11 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
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
69
70
71
72
function [ fig_handle ] = openPlot( )
%Opens the fig file relating to a particular run
StudyDir = 'C:\Users\bjp4\Documents\MATLAB\Study 5 Analysis\COMPLETED';
message = 'Get the table of thresholds, etc. for a participant';
disp(message)
NAME = whichParticipant();
% lo = load([StudyDir '\' NAME '\' 'Incoming' '\' 'collectedTable.mat']);
lo = load([StudyDir '\' NAME '\' 'Combined' '\' 'collectedTable.mat']);
Tcoll = lo.Tcoll;
row = whichFile(Tcoll); %get the row of the results table for the desired plot
anaID = Tcoll.AnaID{row}; %get its name
%Open the figure file!
fig_handle = openfig([StudyDir '\' NAME '\' 'Combined' '\' anaID '.fig']);
%% Sub-functions
function [NAME] = whichParticipant()
d=dir(StudyDir);
str = {d.name};
%for aesthetics, locate and remove fullstop options
fstpIx = cellfun(@(x)all(x == '.'),str);
str = str(~fstpIx);
%list and offer selection
[s,~] = listdlg('PromptString','Select a participant:',...
'SelectionMode','single',...
'ListString',str);
NAME = str{s};
end
function [row] = whichFile(T)
msg = 'SELECT THE ROW OF THE FIGURE TO OPEN, THEN RETURN TO COMMAND WINDOW AND PRESS ENTER';
f = figure('Name',msg);
%mtable = uitable(gcf, 'Data', table2cell(T), 'unit', 'normalized','Position',[0 0 1 1], 'ColumnName',T.Properties.VariableNames);
mtable = uitable(gcf, table2cell(T), T.Properties.VariableNames);
jtable = mtable.getTable;
%make table more accessible (visible)
pos = get(f,'Position');
set(mtable,'Position',[0 0 pos(3:4)])
%Prompt for selection and wait for response
disp(msg)
pause
row = jtable.getSelectedRow + 1; % Java indexes start at 0
ok = input(['Row ',num2str(row),' selected. Is this correct? 1/0']);
ok = (isempty(ok) || ok==1); %just hitting enter will work too
close(gcf)
if ~ok
[row] = whichFile(T);
return
end
end
end