Skip to content

Commit 40f56fc

Browse files
committed
Update checkConfig.m
1 parent df7a428 commit 40f56fc

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

+types/+util/+dynamictable/checkConfig.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function checkConfig(DynamicTable, ignoreList)
3232
columns = setdiff(DynamicTable.colnames, ignoreList);
3333

3434
columnHeights = zeros(length(columns), 1);
35+
columnNames = strings(length(columns), 1);
3536
for iCol = 1:length(columns)
3637
columnName = retrieveHighestIndex(DynamicTable, columns{iCol});
3738
columnHeight = unique(getVectorHeight(getVector(DynamicTable, columnName)));
@@ -40,16 +41,20 @@ function checkConfig(DynamicTable, ignoreList)
4041
'NWB:DynamicTable:CheckConfig:InvalidShape', ...
4142
'Invalid compound column detected: compound column heights must all be the same.');
4243
columnHeights(iCol) = columnHeight;
44+
columnNames(iCol) = columnName;
4345
end
4446

4547
tableHeight = unique(columnHeights);
4648
if isempty(tableHeight)
4749
tableHeight = 0;
4850
end
51+
52+
formatSpec = sprintf(' %%-%ds %%d', max(strlength(columnNames)));
4953
assert(isscalar(tableHeight), ...
5054
'NWB:DynamicTable:CheckConfig:InvalidShape', ...
51-
['Invalid table detected: ' ...
52-
'column heights (vector lengths or number of matrix columns) must be the same.']);
55+
['Invalid table: all columns must have the same height.\n\n' ...
56+
'Detected column heights:\n' ...
57+
strjoin( compose(formatSpec, columnNames, columnHeights), newline) ]);
5358

5459
if isempty(DynamicTable.id)
5560
types.util.dynamictable.internal.initDynamicTableId(DynamicTable, tableHeight);

0 commit comments

Comments
 (0)