Skip to content

Commit feb7135

Browse files
author
Lawrence
committed
Altered DataPipe maxSize requirements
No longer defaults to an infinitely sized vector, throws an error instead if it or `data` do not exist.
1 parent a1b1266 commit feb7135

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

+types/+untyped/DataPipe.m

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
import types.untyped.datapipe.guessChunkSize;
2525

2626
p = inputParser;
27-
p.addParameter('maxSize', [Inf, 1]);
27+
p.addParameter('maxSize', []);
2828
p.addParameter('axis', 1, @(x) isnumeric(x) && isscalar(x) && x > 0);
2929
p.addParameter('offset', 0, @(x) isnumeric(x) && isscalar(x) && x >= 0);
3030
p.addParameter('chunkSize', []);
@@ -75,8 +75,11 @@
7575
end
7676
return;
7777
end
78-
79-
if ~isempty(p.Results.data)
78+
79+
if isempty(p.Results.maxSize)
80+
assert(~isempty(p.Results.data),...
81+
'NWB:DataPipe:MissingArguments',...
82+
'Missing required argument `maxSize` or dependent argument `data`')
8083
maxSize = size(p.Results.data);
8184
maxSize(p.Results.axis) = Inf;
8285
else
@@ -196,4 +199,4 @@ function append(obj, data)
196199
obj.internal = obj.internal.write(fid, fullpath);
197200
end
198201
end
199-
end
202+
end

0 commit comments

Comments
 (0)