@@ -285,7 +285,7 @@ function printHeaderExtraColumns(logFile)
285285 namesExtraColumns{iExtraColumn });
286286
287287 end
288- warningSaveEventsFile (cfg , ' missingData' , warningMessage );
288+ throwWarning (cfg , ' saveEventsFile: missingData' , warningMessage );
289289
290290 if cfg .verbose > 1
291291 disp(logFile(iEvent ));
@@ -297,50 +297,6 @@ function printHeaderExtraColumns(logFile)
297297
298298end
299299
300- function data = checkInput(data )
301- % check the data to write
302- % default will be 'n/a' for chars and NaN for numeric data
303- % for numeric data that don't have the expected length, it will be padded with NaNs
304- if islogical(data ) && data
305- data = ' true' ;
306- elseif islogical(data ) && ~data
307- data = ' false' ;
308- end
309-
310- if ischar(data ) && isempty(data ) || strcmp(data , ' ' )
311- data = ' n/a' ;
312- elseif isempty(data )
313- % important to not set this to n/a as we still need to check if this
314- % numeric valur has the right length and needs to be nan padded
315- data = nan ;
316- end
317-
318- end
319-
320- function data = nanPadding(cfg , data , expectedLength )
321-
322- if nargin < 2
323- expectedLength = [];
324- end
325-
326- if ~isempty(expectedLength ) && isnumeric(data )
327-
328- if max(size(data )) < expectedLength
329- padding = expectedLength - max(size(data ));
330- data(end + 1 : end + padding ) = nan(1 , padding );
331-
332- elseif max(size(data )) > expectedLength
333- warningMessage = [' A field for this event is longer than expected.' , ...
334- ' Truncating extra values.' ];
335- warningSaveEventsFile(cfg , ' arrayTooLong' , warningMessage );
336-
337- data = data(1 : expectedLength );
338-
339- end
340- end
341-
342- end
343-
344300function logFile = saveToLogFile(logFile , cfg )
345301
346302 % appends to the logfile all the data stored in the structure
@@ -367,7 +323,7 @@ function printHeaderExtraColumns(logFile)
367323
368324 skipEvent = true ;
369325
370- warningMessageID = ' emptyEvent' ;
326+ warningMessageID = ' saveEventsFile: emptyEvent' ;
371327 warningMessage = sprintf([' Skipping saving this event. \n ' ...
372328 ' onset: %s \n duration: %s \n ' ], ...
373329 onset , ...
@@ -391,21 +347,21 @@ function printHeaderExtraColumns(logFile)
391347 if all(~isValid )
392348 skipEvent = true ;
393349
394- warningMessageID = ' emptyEvent' ;
350+ warningMessageID = ' saveEventsFile: emptyEvent' ;
395351 warningMessage = sprintf([' Skipping saving this event. \n ' , ...
396352 ' No values defined. \n ' ]);
397353
398354 elseif any(~isValid )
399355 skipEvent = false ;
400356
401- warningMessageID = ' missingData' ;
357+ warningMessageID = ' saveEventsFile: missingData' ;
402358 warningMessage = sprintf(' Missing some %s data for this event. \n ' , ...
403359 namesExtraColumns{find(isValid )});
404360 end
405361 end
406362
407363 % now save the event to log file (if not skipping)
408- warningSaveEventsFile (cfg , warningMessageID , warningMessage );
364+ throwWarning (cfg , warningMessageID , warningMessage );
409365
410366 printToFile(cfg , logFile , skipEvent , iEvent );
411367
@@ -504,14 +460,3 @@ function errorSaveEventsFile(identifier)
504460 error(errorStruct );
505461
506462end
507-
508- function warningSaveEventsFile(cfg , identifier , warningMessage )
509- if cfg .verbose > 0 && ...
510- nargin == 3 && ...
511- ~isempty(identifier ) && ...
512- ~isempty(warningMessage )
513-
514- warningMessageID = [' saveEventsFile:' identifier ];
515- warning(warningMessageID , warningMessage );
516- end
517- end
0 commit comments