|
10 | 10 | 'MatNWB:GetIndex:InvalidColumn',...
|
11 | 11 | 'Column name not found `%s`', column);
|
12 | 12 |
|
13 |
| -vecIndKeys = keys(DynamicTable.vectorindex); |
14 |
| -for i = 1:length(vecIndKeys) |
15 |
| - vik = vecIndKeys{i}; |
16 |
| - if isVecIndColumn(DynamicTable.vectorindex.get(vik), column) |
17 |
| - indexName = vik; |
| 13 | +% after Schema version 2.3.0, VectorIndex objects subclass VectorData which |
| 14 | +% meant that vectorindex and vectordata sets could be combined. |
| 15 | +isLegacyDynamicTable = isprop(DynamicTable, 'vectorindex'); |
| 16 | +if isLegacyDynamicTable |
| 17 | + vecKeys = keys(DynamicTable.vectorindex); |
| 18 | +else |
| 19 | + vecKeys = keys(DynamicTable.vectordata); |
| 20 | +end |
| 21 | +for i = 1:length(vecKeys) |
| 22 | + vk = vecKeys{i}; |
| 23 | + if isLegacyDynamicTable |
| 24 | + vecData = DynamicTable.vectorindex.get(vk); |
| 25 | + else |
| 26 | + vecData = DynamicTable.vectordata.get(vk); |
| 27 | + end |
| 28 | + if ~isa(vecData, 'types.hdmf_common.VectorIndex') |
| 29 | + continue; |
| 30 | + end |
| 31 | + if isVecIndColumn(vecData, column) |
| 32 | + indexName = vk; |
18 | 33 | return;
|
19 | 34 | end
|
20 | 35 | end
|
21 | 36 |
|
| 37 | +% check if dynamic table object has extended properties which point to |
| 38 | +% vector indices. These are specifically defined by the schema to be |
| 39 | +% properties. |
22 | 40 | DynamicTableProps = properties(DynamicTable);
|
23 | 41 | isPropVecInd = false(size(DynamicTableProps));
|
24 | 42 | for i = 1:length(DynamicTableProps)
|
|
27 | 45 |
|
28 | 46 | DynamicTableProps = DynamicTableProps(isPropVecInd);
|
29 | 47 | for i = 1:length(DynamicTableProps)
|
30 |
| - vik = DynamicTableProps{i}; |
31 |
| - VecInd = DynamicTable.(vik); |
| 48 | + vk = DynamicTableProps{i}; |
| 49 | + VecInd = DynamicTable.(vk); |
32 | 50 | if isVecIndColumn(VecInd, column)
|
33 |
| - indexName = vik; |
| 51 | + indexName = vk; |
34 | 52 | return;
|
35 | 53 | end
|
36 | 54 | end
|
|
0 commit comments