@@ -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(' %% -%d s %% 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