Skip to content

Commit 194484f

Browse files
committed
Ensure allInstances is a row vector in addNode
Added a check to reshape allInstances to a row vector if it is a column. This prevents issues when iterating over instances and ensures consistent behavior in the addNode method.
1 parent 434b07b commit 194484f

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

code/+openminds/@Collection/Collection.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,10 @@ function updateLinks(obj)
331331
allInstances = [allInstances{:}];
332332
end
333333

334+
if iscolumn(allInstances)
335+
allInstances = reshape(allInstances, 1, []);
336+
end
337+
334338
for instance = allInstances
335339
obj.addNode(instance{1}, ...
336340
'AddSubNodesOnly', true, ...
@@ -523,7 +527,6 @@ function load(obj, loadPath, options)
523527
% Add subnodes first
524528
obj.addSubNodes(instance)
525529

526-
527530
if ~options.AddSubNodesOnly
528531
obj.Nodes(instance.id) = {instance};
529532
wasAdded = true;

0 commit comments

Comments
 (0)