NeurodataWithoutBorders / matnwb

A Matlab interface for reading and writing NWB files
BSD 2-Clause "Simplified" License
50 stars 32 forks source link

[Bug]: `toTable` and `getRow` indexing errors when indexing certain columns. #505

Closed lawrence-mbf closed 1 year ago

lawrence-mbf commented 1 year ago

What happened?

There are 2 errors regarding toTable and getRow:

1) If the data is a matrix, indexing into the saved DataStub causes an error 2) if the data is empty (that is, the ragged index to the data has a length of zero) an error also occurs.

Steps to Reproduce

Will format later

Error Message

Error using hdf5lib2
The HDF5 library encountered an error and produced the following stack trace information:

    H5Sselect_elements    elements not specified

Error in H5S.select_elements (line 43)
H5ML.hdf5lib2('H5Sselect_elements', space_id, op, h5_coord);

Error in types.untyped.DataStub/load_mat_style (line 170)
                H5S.select_elements(readSid, 'H5S_SELECT_SET', ...

Error in indexing (line 380)
            data = obj.load_mat_style(CurrentSubRef.subs{:});

Error in types.util.dynamictable.getRow>select (line 135)
        selected = Vector.data(selectInd{:});

Error in types.util.dynamictable.getRow>select (line 170)
        selected{iRange} = select(DynamicTable,...

Error in types.util.dynamictable.getRow (line 44)
    row{i} = select(DynamicTable, indexNames, ind);

Error in types.hdmf_common.DynamicTable/getRow (line 119)
        row = types.util.dynamictable.getRow(obj, id, varargin{:});

Error in types.util.dynamictable.nwbToTable (line 81)
matlabTable = [matlabTable DynamicTable.getRow( ...

Error in types.hdmf_common.DynamicTable/toTable (line 123)
        table = types.util.dynamictable.nwbToTable(obj, varargin{:});

Operating System

Windows

Matlab Version

2023a

Code of Conduct

lawrence-mbf commented 1 year ago

It is unclear how (1) causes an error but the error is no longer recreatable on master, either when indexed, loaded, or toTable'd