-
Notifications
You must be signed in to change notification settings - Fork 32
/
nwbExport.m
32 lines (29 loc) · 1.21 KB
/
nwbExport.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function nwbExport(nwbFileObjects, filePaths, mode)
%NWBEXPORT Writes an NWB file.
% nwbRead(nwb, filename) Writes the nwb object to a file at filename.
%
% Example:
% % Generate Matlab code for the NWB objects from the core schema.
% % This only needs to be done once.
% generateCore('schema\core\nwb.namespace.yaml');
% % Create some fake fata and write
% nwb = NwbFile;
% nwb.session_start_time = datetime('now');
% nwb.identifier = 'EMPTY';
% nwb.session_description = 'empty test file';
% nwbExport(nwb, 'empty.nwb');
%
% See also GENERATECORE, GENERATEEXTENSION, NWBFILE, NWBREAD
arguments
nwbFileObjects (1,:) NwbFile {mustBeNonempty}
filePaths (1,:) string {mustBeNonzeroLengthText}
mode (1,1) string {mustBeMember(mode, ["edit", "overwrite"])} = "edit"
end
assert(length(nwbFileObjects) == length(filePaths), ...
'NWB:Export:FilepathLengthMismatch', ...
'Lists of NWB objects to export and list of file paths must be the same length.')
for iFiles = 1:length(nwbFileObjects)
filePath = char(filePaths(iFiles));
nwbFileObjects(iFiles).export(filePath, mode);
end
end