Error opening nwb files

Thanks for this debugging work.

** Invalid option. Option must be 'omitnan' or 'includenan'.
It seems to require a newer version of max(). So I changed to R2019b and the error above disappeared

This error is to be handled at the level of the matnwb library.
I opened an issue here: [Bug]: Syntax valid only after Matlab 2018b · Issue #437 · NeurodataWithoutBorders/matnwb · GitHub

I'm not sure if it's just an issue about labeling or the data was badly formatted (I obtained the data from an open database). As mentioned by mpompolas, the key names in NWB could be arbitrary.

One issue with NWB is indeed the lack of specifications, which makes it difficult to obtain reproducible data structures that can be processed automatically.

If you know how to use github, could you open a PR on the Brainstorm repository to fix this function?
Ideally, your fix should check for the existence of the field "group_name", and if it doesn't exist, use your new code instead.

If you don't know how to use GitHub or don't want to push this contribution yourself: please share your edited function and an example .nwb file (upload it somewhere and post the download link here).
Thanks

Hi there!

Thank you both.
Just for the context, the NWB dataset which we are working on is the one described in Dataset of human intracranial recordings during famous landmark identification (Woolnough, O., Kadipasaoglu, C.M., Conner, C.R., Forseth, K.J., Rollo, P.S., Rollo, M.J., Baboyan, V.G., Tandon, N., 2022. Sci Data 9, 28.). Colleagues nearby @John_Mosher I believe.

Best,
AnneSo

The first issue has already been fixed in the matnwb reprository:. [Bug]: Syntax valid only after Matlab 2018b · Issue #437 · NeurodataWithoutBorders/matnwb · GitHub

Thank you for your reply ! Now we get another error wrt. the channels (please see below an example).
The NWB data provide a DynamicTable that stores the information of electrodes (e.g., good/bad, locations), but in some participants, the raw data contain more electrodes. In the case below, the number of electrodes listed in the DynamicTable is 181. Brainstorm may somehow read the number of electrodes from raw data (?) and the number is 194.

So in Line180 ChannelMat.Channel(ii).Loc = [x(iChannel);y(iChannel);z(iChannel)];, the length of ChannelMat.Channel.Loc (which is 194) and the length of x, y, z (which is 181) don't match.

** Error: Line 180: Index exceeds the number of array elements (181).
**
** Call stack:
** >in_fopen_nwb.m at 180
** >in_fopen.m at 159
** >import_raw.m at 126
** >bst_call.m at 28
** >tree_callbacks.m>@(h,ev)bst_call(@import_raw,,,iSubject) at 660

We're working on this issue and will test Brainstorm on other participants. We will open a PR once the code works smoothly.

Thank you !

The PR is now merged: NWB: Added the examination of channel information before loading data. by ws1011001 · Pull Request #556 · brainstorm-tools/brainstorm3 · GitHub

Could you please share an example dataset?
(upload a .nwb file somewhere an post the download link here)

Thanks!