Multiple nwbRead() and nwbExport() actions will cause the error of 'nwb.file_create_date'.
To fix it, replace the code Line30-36 in the file NwbFile.m calldef NwbFile < types.core.NWBFile with
% fix the bug when nwbRead and nwbExport more than 2 times
if isempty(obj.file_create_date)
obj.file_create_date = num2cell(current_time);
elseif iscell(obj.file_create_date)
obj.file_create_date(end+1) = num2cell(current_time);
else
% obj.file_create_date could be a datetime array
obj.file_create_date = num2cell(obj.file_create_date);
obj.file_create_date(end+1) = num2cell(current_time);
end
Error using assert
Timestamp `22002233--0099--2222TT1155::1189::4552..318807953506++0022::0000` is not a valid ISO8601 subset for NWB:
YMD should be in the form YYYY-mm-dd or YYYYmmdd
Error in io.timestamp2datetime>detectDatetime (line 37)
assert(length(ymdStamp) == 10, errorId, errorMessage);
Error in io.timestamp2datetime (line 15)
Datetime = detectDatetime(timestampString);
Error in types.util.correctType (line 29)
val = formatDatetime(io.timestamp2datetime(val));
Error in types.util.checkDtype (line 126)
correctedValue = types.util.correctType(value, typeDescriptor);
Error in types.core.NWBFile/validate_file_create_date (line 335)
val = types.util.checkDtype('file_create_date', 'datetime', val);
Error in types.core.NWBFile/set.file_create_date (line 187)
obj.file_create_date = obj.validate_file_create_date(val);
Error in types.core.NWBFile (line 127)
obj.file_create_date = p.Results.file_create_date;
Error in NwbFile (line 16)
obj = obj@types.core.NWBFile(varargin{:});
Error in io.parseGroup (line 76)
parsed = NwbFile(kwargs{:});
Error in nwbRead (line 79)
nwb = io.parseGroup(filename, h5info(filename), Blacklist);
What happened?
Multiple nwbRead() and nwbExport() actions will cause the error of 'nwb.file_create_date'.
To fix it, replace the code Line30-36 in the file
NwbFile.m calldef NwbFile < types.core.NWBFile
withThe file location:![Codefile](https://github.com/NeurodataWithoutBorders/matnwb/assets/11210815/ad4d4a75-5d98-498c-abc9-1678f6382ac9)
The old code:![Old code](https://github.com/NeurodataWithoutBorders/matnwb/assets/11210815/4ea662cd-4338-4fcc-bb15-49cd8b9fcdc3)
The new code:![Fixed code](https://github.com/NeurodataWithoutBorders/matnwb/assets/11210815/fb50a7f9-aa64-4c99-abb2-85daf432deb1)
Steps to Reproduce
To reproduce the error, run
Error Message
Operating System
Matlab Version
R2023a
Code of Conduct