-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparticipant_info_gui.m
More file actions
40 lines (34 loc) · 1.29 KB
/
participant_info_gui.m
File metadata and controls
40 lines (34 loc) · 1.29 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
% participant_info_gui() - This function brings up an input dialog box to
% enter participant information that can be stored
% in a *_participants.tsv file for the BIDS
% formatting.
%
% Usage:
% >> info = participant_info_gui( id, fields)
%
% Required inputs:
% id - participant identifier (will be prepended with sub* if it is
% not present.
% fields - cell array of strings for the particular fields to enter.
% Prepends the field 'participant_id' to the fields list.
%
% Outputs:
% info - data table object containing the participant information
%
% Created by: Joshua D. Koen, University of Notre Dame
% Created on: 2019/06/17
function info = participant_info_gui( id, fields )
% Define the input GUI parameters
prompt = ['participant_id' fields];
struct_fields = cellfun(@(x) strrep(x,' ','_'), prompt, 'UniformOutput', false);
dlg_title = 'Enter Participant Info:';
dimensions = [1 50];
def = [ id repmat({''}, size(fields)) ];
% Define gui options
options.Resize='on';
options.WindowStyle='normal';
% Display gui
info = inputdlg(prompt, dlg_title, dimensions, def, options);
% Covert output structure to data table
info = struct2table( cell2struct(info, struct_fields,1 ) );
end % of function