What happened?
|
if ~isempty(DynamicTable.colnames) |
|
tableHeight = types.util.dynamictable.getColumnHeight(DynamicTable.id); |
|
end |
This computes tableHeight from DynamicTable.id whenever colnames is non-empty. If a table has existing columns but no id (which is possible), tableHeight becomes 0 and new columns will incorrectly fail height validation. Consider inferring height via types.util.dynamictable.internal.getTableHeight(DynamicTable) (and/or initializing id when missing) rather than assuming id is present.
Steps to Reproduce
dynamicTable = types.core.TimeIntervals();
dynamicTable.start_time = types.hdmf_common.VectorData('data', 1:10);
dynamicTable.colnames = {'start_time'};
dynamicTable.addColumn('trial_outcome', types.hdmf_common.VectorData('data', randi(4,[1,10])))
Error Message
Error using types.util.dynamictable.addVarargColumn>validateColumnHeight (line 87)
Column `trial_outcome` has detected height 10, but the table height is 0.
Error in types.util.dynamictable.addVarargColumn (line 58)
validateColumnHeight(new_cn, currentColumnHeight, tableHeight)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in types.util.dynamictable.addColumn (line 37)
types.util.dynamictable.addVarargColumn(DynamicTable, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in types.hdmf_common.DynamicTable/addColumn (line 119)
types.util.dynamictable.addColumn(obj, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Operating System
macOS
Matlab Version
R2024b
Code of Conduct
What happened?
matnwb/+types/+util/+dynamictable/addVarargColumn.m
Lines 24 to 26 in 2b4425e
This computes
tableHeightfromDynamicTable.idwhenevercolnamesis non-empty. If a table has existing columns but noid(which is possible),tableHeightbecomes 0 and new columns will incorrectly fail height validation. Consider inferring height viatypes.util.dynamictable.internal.getTableHeight(DynamicTable)(and/or initializingidwhen missing) rather than assumingidis present.Steps to Reproduce
Error Message
Operating System
macOS
Matlab Version
R2024b
Code of Conduct