@@ -285,7 +285,7 @@ function printHeaderExtraColumns(logFile)
285
285
namesExtraColumns{iExtraColumn });
286
286
287
287
end
288
- warningSaveEventsFile (cfg , ' missingData' , warningMessage );
288
+ throwWarning (cfg , ' saveEventsFile: missingData' , warningMessage );
289
289
290
290
if cfg .verbose > 1
291
291
disp(logFile(iEvent ));
@@ -297,50 +297,6 @@ function printHeaderExtraColumns(logFile)
297
297
298
298
end
299
299
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
-
344
300
function logFile = saveToLogFile(logFile , cfg )
345
301
346
302
% appends to the logfile all the data stored in the structure
@@ -367,7 +323,7 @@ function printHeaderExtraColumns(logFile)
367
323
368
324
skipEvent = true ;
369
325
370
- warningMessageID = ' emptyEvent' ;
326
+ warningMessageID = ' saveEventsFile: emptyEvent' ;
371
327
warningMessage = sprintf([' Skipping saving this event. \n ' ...
372
328
' onset: %s \n duration: %s \n ' ], ...
373
329
onset , ...
@@ -391,21 +347,21 @@ function printHeaderExtraColumns(logFile)
391
347
if all(~isValid )
392
348
skipEvent = true ;
393
349
394
- warningMessageID = ' emptyEvent' ;
350
+ warningMessageID = ' saveEventsFile: emptyEvent' ;
395
351
warningMessage = sprintf([' Skipping saving this event. \n ' , ...
396
352
' No values defined. \n ' ]);
397
353
398
354
elseif any(~isValid )
399
355
skipEvent = false ;
400
356
401
- warningMessageID = ' missingData' ;
357
+ warningMessageID = ' saveEventsFile: missingData' ;
402
358
warningMessage = sprintf(' Missing some %s data for this event. \n ' , ...
403
359
namesExtraColumns{find(isValid )});
404
360
end
405
361
end
406
362
407
363
% now save the event to log file (if not skipping)
408
- warningSaveEventsFile (cfg , warningMessageID , warningMessage );
364
+ throwWarning (cfg , warningMessageID , warningMessage );
409
365
410
366
printToFile(cfg , logFile , skipEvent , iEvent );
411
367
@@ -504,14 +460,3 @@ function errorSaveEventsFile(identifier)
504
460
error(errorStruct );
505
461
506
462
end
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