22
22
%
23
23
%
24
24
% action:
25
- % - 'open': will create the file ID and return it in logFile.eventLogFile using the information in
25
+ % - 'open': will create the file ID and return it in logFile.fileID using the information in
26
26
% the expParameters structure. This file ID is then reused when calling that function to save data
27
27
% into this file.
28
28
% This creates the header with the obligatory 'onset', 'trial_type', 'duration' required bt BIDS and other
29
29
% coluns can be specified in varargin.
30
30
% example : logFile = saveEventsFile('open', expParameters, [], 'direction', 'speed', 'target');
31
31
%
32
- % - 'save': will save the data contained in logfile by using the file ID logFile.eventLogFile ;
32
+ % - 'save': will save the data contained in logfile by using the file ID logFile.fileID ;
33
33
% logfile must then contain:
34
34
% - logFile.onset
35
35
% - logFile.trial_type
36
36
% - logFile.duration
37
37
% The name of any extra column whose content must be saved should be listed in varargin.
38
38
%
39
- % - 'close': closes the file with file ID logFile.eventLogFile . If expParameters.verbose is set to true
39
+ % - 'close': closes the file with file ID logFile.fileID . If expParameters.verbose is set to true
40
40
% then this will tell you where the file is located.
41
41
%
42
42
% See test_saveEventsFile in the test folder for more details on how to use it.
53
53
54
54
% Initialize txt logfiles and empty fields for the standard BIDS
55
55
% event file
56
- logFile.eventLogFile = fopen(...
56
+ logFile.fileID = fopen(...
57
57
fullfile(...
58
58
expParameters .outputDir , ...
59
59
expParameters .modality , ...
68
68
69
69
% Initialize txt logfiles and empty fields for the standard BIDS
70
70
% event file
71
- logFile.eventLogFile = fopen(...
71
+ logFile.fileID = fopen(...
72
72
fullfile(...
73
73
expParameters .outputDir , ...
74
74
expParameters .modality , ...
87
87
% first with the standard BIDS data and then any extra things
88
88
for iEvent = 1 : size(logFile ,1 )
89
89
90
- fprintf(logFile(1 ).eventLogFile ,' %f\t%s\t%f\t ' ,...
90
+ fprintf(logFile(1 ).fileID ,' %f\t%s\t%f\t ' ,...
91
91
logFile(iEvent ).onset, ...
92
92
logFile(iEvent ).trial_type, ...
93
93
logFile(iEvent ).duration);
109
109
end
110
110
111
111
if ischar(data )
112
- fprintf(logFile(1 ).eventLogFile , ' %s\t ' , data );
112
+ fprintf(logFile(1 ).fileID , ' %s\t ' , data );
113
113
else
114
- fprintf(logFile(1 ).eventLogFile , ' %f\t ' , data );
114
+ fprintf(logFile(1 ).fileID , ' %f\t ' , data );
115
115
end
116
116
117
117
end
118
118
119
- fprintf(logFile(1 ).eventLogFile , ' \n ' );
119
+ fprintf(logFile(1 ).fileID , ' \n ' );
120
120
end
121
121
122
122
case ' close'
123
123
124
124
% close txt log file
125
- fclose(logFile(1 ).eventLogFile );
125
+ fclose(logFile(1 ).fileID );
126
126
127
127
if expParameters .verbose
128
128
fprintf(1 ,' \n Data were saved in this file:\n\n%s\n\n ' , ...
140
140
function initializeHeader(logFile , varargin )
141
141
142
142
% print the basic BIDS columns
143
- fprintf(logFile .eventLogFile , ' %s\t%s\t%s\t ' , ' onset' , ' trial_type' , ' duration' );
143
+ fprintf(logFile .fileID , ' %s\t%s\t%s\t ' , ' onset' , ' trial_type' , ' duration' );
144
144
145
145
% print any extra column specified by the user
146
146
% also prepare an empty field in the structure to collect data
147
147
% for those
148
148
for iExtraColumn = 1 : numel(varargin{1 })
149
- fprintf(logFile .eventLogFile ,' %s\t ' , lower(varargin{1 }{iExtraColumn }));
149
+ fprintf(logFile .fileID ,' %s\t ' , lower(varargin{1 }{iExtraColumn }));
150
150
end
151
151
152
152
% next line so we start printing at the right place
153
- fprintf(logFile .eventLogFile , ' \n ' );
153
+ fprintf(logFile .fileID , ' \n ' );
154
154
155
155
end
0 commit comments