arnodelorme / mffmatlabio

MFF Matlab file importer and exporter
GNU General Public License v3.0
11 stars 16 forks source link

Error : creating a new mff file #21

Closed emmatx closed 4 years ago

emmatx commented 4 years ago

Hi Arnaud, I followed your recent tutorial : https://github.com/arnodelorme/mffmatlabio/wiki/5.-Use-with-Fieldtrip ; it works perfectly when I use your data, but when I try with mine (from HD EEG, continuous file) , I get 2 types of errors :

1- When I just read my data, no processing at all, and re-define a file ..... Epochs.xml file created successfully Array indices must be positive integers or logical values. Error in mff_exportepochs (line 63) durations = [0 durations durations(end) ]; .....

2 - When I define one trial with the onset trigger line, and apply the ft_preprocessing function, I get ..... Info.xml file created successfully info1.xml file created successfully Signal binary file created successfully Index in position 1 exceeds array bounds (must not exceed 1). Error in mff_exportsignal (line 118) data = single(EEG.data(chanRange{iFile}, samples(iSample-1)+1:samples(iSample)))';

Do you have an idea where it comes from or if it is a bug ? Thanks for your help !

arnodelorme commented 4 years ago

Sorry for the late answer. Would you mind to share a data file?

arnodelorme commented 4 years ago

Closing the bug because no data file

emmatx commented 4 years ago

Hello, Thanks for your interest. I finally resolved the problem in my file ; then I got an error in mff_exportinfon, but only if it uses the brainstorm version. line 66 : tmp2.setPNSName('EEGLAB exported PNS channels');

setPNSName is not recognized. So I modified it by your code in matlabio master toolbox, that is line 66 : tmp2.setPNSSetName('EEGLAB exported PNS channels');

and it worked. Jut in case it can help someone !

arnodelorme commented 4 years ago

Wonderful. I will pass the code along to Brainstorm.

ftadel commented 4 years ago

@emmatx I updated Brainstorm to use the new version 3.1 of the library: https://github.com/brainstorm-tools/brainstorm3/commit/caca0c187599a1488e618aa811cc63323f359b0b

Please update Brainstorm and try again. When trying to import a new .mff file, it should download the new version of the library automatically.

arnodelorme commented 4 years ago

Thank you Francois,

I was planning to send you an email next month after I make sure everything is stable. But now is fine as well. Cheers,

Arno

On Apr 1, 2020, at 10:10 AM, Francois notifications@github.com wrote:

@emmatx I updated Brainstorm to use the new version 3.1 of the library. Please update Brainstorm and try again. When trying to import a new .mff file, it should download the new version of the library automatically.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.

emmatx commented 4 years ago

@ftadel I tried with the update, and I get


Unrecognized function or variable 'boundaryEvent'.

Error in mff_exportepochs (line 60) if isfield(EEG.event, 'duration') && ~isempty(boundaryEvent)

Error in mff_export (line 62) mff_exportepochs(EEG, outputFile);

Error in mff_fileio_write (line 54) mff_export(EEG, filename);

Error in ft_write_data (line 433) mff_fileio_write(filename, hdr, dat, evt);

Error in EEG_reshape_0323 (line 158) ft_write_data(fullfile(pwd, 'EEG_new_brainstorm.mff'), EEG_data.trial{1}, 'header', EEG_data.hdr, 'event', new_events, 'dataformat', 'mff');


In fact, I also modified a line in mff_exportepochs but it was one week ago and I forgot to tell you, I'm sorry : there's an if condition around line 60 to extract the durations ("if EEG.trials == 1"); in your tutorial @arnodelorme , as there are several trials, I think these lines were not read. Then my file uses the condition (if isfield(EEG.event, 'duration') && ~isempty(boundaryEvent)), however the variable boundaryEvent (and samples also) are defined inside another loop, I think this is why they aren't recognized. I just simplified it by setting all my durations to 0 because I needed to run it quickly. I hope I explained correctly, I'm relatively new to all of this. Let me know if you still need my data and code to get clearer explanations.

ftadel commented 4 years ago

@emmatx I guess this has nothing to do with Brainstorm, as we are not calling ft_write_data or mff_fileio_write anywhere in the Brainstorm code. Do you have any issue specifically with Brainstorm?

arnodelorme commented 4 years ago

Yes, this is a problem with the Fieldrip function - which calls the plugin. Send me the data you are trying to write and the commands you are using to write it and we will see if we can reproduce the problem.

emmatx commented 4 years ago

Here is the link : https://www.dropbox.com/sh/84k63p1dkt7prbb/AAC6736qVU_9u4gqy1Kkariaa?dl=0 Thank you !

arnodelorme commented 4 years ago

I have fixed the issue in version 3.2. You will need to replace the folder Fieldtripxxxxx/external/mffmatlabio with a clone of this folder before you can make your script work.

emmatx commented 4 years ago

Thank you ; I updated fieldtrip today, and I tried. I got this error :


Unrecognized function or variable 'boundaryEvent'.

Error in mff_exportepochs (line 60) if isfield(EEG.event, 'duration') && ~isempty(boundaryEvent)

Error in mff_export (line 62) mff_exportepochs(EEG, outputFile);

Error in mff_fileio_write (line 54) mff_export(EEG, filename);

Error in ft_write_data (line 433) mff_fileio_write(filename, hdr, dat, evt);

Error in sync_3_fitting_and_file (line 174) ft_write_data(fullfile(pwd, output_file), EEG_data.trial{1}, 'header', EEG_data.hdr, 'event', new_events, 'dataformat', 'mff');


arnodelorme commented 4 years ago

Yes, you have to replace the external/mffmatlabio folder with a copy of the current code on Github. Cheers,

Arno

On Apr 9, 2020, at 6:56 PM, emmatx notifications@github.com wrote:

Thank you ; I updated fieldtrip today, and I tried. I got this error :

Unrecognized function or variable 'boundaryEvent'.

Error in mff_exportepochs (line 60) if isfield(EEG.event, 'duration') && ~isempty(boundaryEvent)

Error in mff_export (line 62) mff_exportepochs(EEG, outputFile);

Error in mff_fileio_write (line 54) mff_export(EEG, filename);

Error in ft_write_data (line 433) mff_fileio_write(filename, hdr, dat, evt);

Error in sync_3_fitting_and_file (line 174) ft_write_data(fullfile(pwd, output_file), EEG_data.trial{1}, 'header', EEG_data.hdr, 'event', new_events, 'dataformat', 'mff');

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or unsubscribe.