7373 %
7474
7575 if nargin < 2
76- errorSaveEventsFile(' missingArgument' )
76+ errorSaveEventsFile(' missingArgument' );
7777 end
7878
7979 if nargin < 3 || isempty(logFile )
129129 fclose(logFile(1 ).fileID);
130130
131131 message = sprintf(' \n Data were saved in this file:\n\n%s\n\n ' , ...
132- fullfile( ...
133- cfg .dir .outputSubject , ...
134- cfg .fileName .modality , ...
135- logFile .filename ));
132+ fullfile( ...
133+ cfg .dir .outputSubject , ...
134+ cfg .fileName .modality , ...
135+ logFile .filename ));
136136 talkToMe(cfg , message );
137137
138138 otherwise
@@ -267,8 +267,8 @@ function printHeaderExtraColumns(logFile)
267267
268268function logFile = checkExtracolumns(logFile , iEvent , cfg )
269269 % loops through the extra columns
270- % if the field we are looking for does not exist or is empty in the
271- % action logFile structure we will write a n/a
270+ % if the field we are looking for does not exist or is empty in the action logFile structure
271+ % we will write a n/a
272272 % otherwise we write its content
273273
274274 namesExtraColumns = returnNamesExtraColumns(logFile );
@@ -343,20 +343,21 @@ function printHeaderExtraColumns(logFile)
343343 expectedLength = [];
344344 end
345345
346- if ~isempty(expectedLength ) && isnumeric(data )
347-
346+ if ~isempty(expectedLength ) && isnumeric(data )
347+
348348 if max(size(data )) < expectedLength
349-
349+
350350 padding = expectedLength - max(size(data ));
351351 data(end + 1 : end + padding ) = nan(1 , padding );
352-
352+
353353 elseif max(size(data )) > expectedLength
354-
355- warningMessage = ' A field for this event is longer than expected. Truncating extra values.' ;
354+
355+ warningMessage = [' A field for this event is longer than expected.' , ...
356+ ' Truncating extra values.' ];
356357 warningSaveEventsFile(cfg , ' arrayTooLong' , warningMessage );
357358
358359 data = data(1 : expectedLength );
359-
360+
360361 end
361362 end
362363
@@ -402,14 +403,14 @@ function printHeaderExtraColumns(logFile)
402403
403404 namesExtraColumns = returnNamesExtraColumns(logFile );
404405 isValid = ones(1 , numel(namesExtraColumns ));
405-
406+
406407 for iExtraColumn = 1 : numel(namesExtraColumns )
407408 data = logFile(iEvent ).(namesExtraColumns{iExtraColumn });
408409 if isempty(data ) || all(isnan(data )) || (ischar(data ) && strcmp(data , ' n/a' ))
409410 isValid(iExtraColumn ) = 0 ;
410411 end
411412 end
412-
413+
413414 if all(~isValid )
414415 skipEvent = true ;
415416
@@ -468,13 +469,13 @@ function printData(output, data, cfg)
468469 % write char
469470 % for numeric data we replace any nan by n/a
470471 if ischar(data )
471-
472+
472473 content = sprintf(' %s\t ' , data );
473474 fprintf(output , content );
474475 talkToMe(cfg , content );
475-
476+
476477 else
477-
478+
478479 for i = 1 : numel(data )
479480 if isnan(data(i ))
480481 content = sprintf(' %s\t ' , ' n/a' );
@@ -485,7 +486,7 @@ function printData(output, data, cfg)
485486 fprintf(output , content );
486487 talkToMe(cfg , content );
487488 end
488-
489+
489490 end
490491end
491492
@@ -516,8 +517,8 @@ function errorSaveEventsFile(identifier)
516517 switch identifier
517518 case ' missingArgument'
518519 errorStruct.message = [' Missing arguments. Please specify <action input> ' , ...
519- ' and <cfg file> as the first two arguments' ];
520-
520+ ' and <cfg file> as the first two arguments' ];
521+
521522 case ' unknownActionType'
522523 errorStruct.message = ' unknown action for saveEventsFile' ;
523524
0 commit comments