When I tried to load 2nd or later rows in dynamic tables with types.util.dynamictable.getRow, it returned the data with the last element of the previous row. Here is the snippet to exemplify the problem.
clear;
generateCore();
% generate the table
dynTable = types.hdmf_common.DynamicTable(...
'colnames', {'foo','goo'},...
'description', 'aaa',...
'id', types.hdmf_common.ElementIdentifiers(...
'data', []),...
'foo', types.hdmf_common.VectorData('description', 'foo'),...
'foo_index', types.hdmf_common.VectorIndex('target', types.untyped.ObjectView('/dynTable/foo')),...
'goo', types.hdmf_common.VectorData('description', 'goo'),...
'goo_index', types.hdmf_common.VectorIndex('target', types.untyped.ObjectView('/dynTable/goo')));
% add rows
for i = 1:10
dynTable.addRow(...
'id', i,...
'foo', i,...
'goo', (1:i)')
end
% get the 3rd row
dat = dynTable.getRow(3, 'useID', true', 'columns', {'foo','goo'})
dat = 1×2 table
foo goo
____________ ____________
{2×1 double} {4×1 double}
dat.foo{1}
dat.goo{1}
ans =
2
3
ans =
2
1
2
3
When I tried to load 2nd or later rows in dynamic tables with types.util.dynamictable.getRow, it returned the data with the last element of the previous row. Here is the snippet to exemplify the problem.
The expected output should be
and dat.foo{1} = 3, dat.goo{1} = [1; 2; 3]
Here, the 3rd row was loaded and "foo" should be 3 and "goo" should be [1; 2; 3], but both have an extra 2 at the beginning.
This seems to be happining because the types.util.dynamictable.getRow.m is written as 0-index. Here is an idea of fixing that https://github.com/ryaoki/matnwb/commit/2b24e480dcee59a197959e8c98ab2589577d744d