sccn / EEG-BIDS

23 stars 17 forks source link

Participant, import custom files #28

Closed arnodelorme closed 4 years ago

arnodelorme commented 4 years ago

I think we should also allow importing tab-delimited files. You are using readtable which is good because it is general. I would put the .txt extension first on the list.

The first GUI to enter a file name is not necessary, simply have pop up warning message indicating that the first row must contain a header, then people press OK and can select a file.

When the number of rows is not right, it crashes. It should return an error instead. Thanks Dung

dungscout96 commented 4 years ago

I realized that there's currently a glitch between mac catalina and matlab uigetfile documented here: https://www.mathworks.com/matlabcentral/answers/484281-why-am-i-unable-to-select-a-file-when-i-use-uigetfile-function-on-the-newest-mac-operation-system Basically only the first file format in the list of formats is selectable. My current work-around is to list allowed file extensions in the header warning dialog, enable all files during selection, and parse the filepath after, aborting if extension is not among allowed ones.

For tsv files, unfortunately readtable() doesn't support tsv. My current work-around is to copy the tsv file into txt, then remove the txt file after import. I'm using MATLAB copyfile() and delete() functions, not sure if there will be permission issue for other machines (mine works fine).

On the row inconsistent error, can you provide the problematic file? I added a try catch block around the readtable call and return error message if encountered.

arnodelorme commented 4 years ago

My current work-around is to list allowed file extensions in the header warning dialog, enable all files during selection, and parse the filepath after, aborting if extension is not among allowed ones.

That sounds right. It is not really a bug, because there is an option button that allows you to change the type of file to select. It is highly misleading though so your solution is better,.

For tsv files, unfortunately readtable() doesn't support tsv. My current work-around is to copy the tsv file into txt, then remove the txt file after import. I'm using MATLAB copyfile() and delete() functions, not sure if there will be permission issue for other machines (mine works fine).

Sounds good. Did you try to force ‘FileType’ to ’text’

readtable(’test.tsv’, ‘filetype’, ’text’);

On the row inconsistent error, can you provide the problematic file? I add a try catch block around the readtable call and return error message if encountered.

I was just saying to check that the number of rows (minus header) match the number of subjects. I think you are already doing that though.

dungscout96 commented 4 years ago

That sounds right. It is not really a bug, because there is an option button that allows you to change the type of file to select. It is highly misleading though so your solution is better,.

Worse than that when switched to different type from the first option no file is selectable. It's too bad...

Sounds good. Did you try to force ‘FileType’ to ’text’

No I haven't. That worked! Much simpler solution.

I was just saying to check that the number of rows (minus header) match the number of subjects. I think you are already doing that though.

I'm not currently checking that. I'm matching subjects in the spreadsheet with the subjects in the GUI using participant ID and only import data for matched ones.

arnodelorme commented 4 years ago

I'm not currently checking that. I'm matching subjects in the spreadsheet with the subjects in the GUI using participant ID and only import data for matched ones.

OK. Maybe make sure you have a match in the Excel/text file for all subjects in EEGLAB - if not issue an error - and if there are additional ones in the Excel/text file, simply issue a warning on the command line. Tx