sccn / EEG-BIDS

21 stars 17 forks source link

Error importing BIDS folder to STUDY - pop_importbids Line 99 #112

Closed jamejia12 closed 4 months ago

jamejia12 commented 2 years ago

Hi,

I am using the BIDS Tools' option for importing BIDS folder to STUDY.

My main BIDS folder ONLY has the sub-xx folders, with their corresponding subfolders and .set files. That main folder does not have any .json or .tsv of any kind, and neither do the sub-xx folders. I then click "File > BIDS Tools > Import BIDS folder to STUDY", and browse the main BIDS folder. When the pop_importbids GUI pops up, I leave all the boxes unticked as all the info needed is already on the .set files. However, when trying to import, it shows an error on Line 99 of pop_importbids (it is trying to read the events.tsv, but since there is no such file it creates an indexing problem at that line). I am using Matlab2017b, and I am not sure if the null-indexing issue is solved in newer versions.

Replacing that line (Line 99 of pop_importbids: options = { 'eventtype' type_fields{res.typefield} }) by the following line seems to solve the issue:

      if ~isempty(type_fields),   options = { 'eventtype' type_fields{res.typefield} };   else options = { 'eventtype', ''}; end

That modification works for me and I just wanted to raise the issue to prevent others that might encounter the same error.

Thank you, Jhony Mejia

dungscout96 commented 2 years ago

Hi Jhony, What's the exact error that you received? Can you check if type_fields is empty at that point, which it should be in your case?

jamejia12 commented 2 years ago

Hi Dung, The exact error is "Index exceeds matrix dimensions". And yes, type_fields is indeed empty (I am not sure if in newer versions of Matlab the error of indexing an empty cell is solved). Anyway, adding the if statement seems to solve the issue and allows me to correctly import the BIDS dataset.

dungscout96 commented 4 months ago

We are now handling absent metadata files in various cases. Please let us know if it still causes issues.