Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error : creating a new mff file #21

Closed
emmatx opened this issue Mar 12, 2020 · 13 comments
Closed

Error : creating a new mff file #21

emmatx opened this issue Mar 12, 2020 · 13 comments

Comments

@emmatx
Copy link

emmatx commented Mar 12, 2020

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
Copy link
Owner

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

@arnodelorme
Copy link
Owner

Closing the bug because no data file

@emmatx
Copy link
Author

emmatx commented Mar 30, 2020

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
Copy link
Owner

Wonderful. I will pass the code along to Brainstorm.

@ftadel
Copy link
Contributor

ftadel commented Apr 1, 2020

@emmatx I updated Brainstorm to use the new version 3.1 of the library: brainstorm-tools/brainstorm3@caca0c1

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
Copy link
Owner

arnodelorme commented Apr 1, 2020 via email

@emmatx
Copy link
Author

emmatx commented Apr 1, 2020

@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
Copy link
Contributor

ftadel commented Apr 2, 2020

@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
Copy link
Owner

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
Copy link
Author

emmatx commented Apr 3, 2020

@arnodelorme arnodelorme reopened this Apr 7, 2020
@arnodelorme
Copy link
Owner

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
Copy link
Author

emmatx commented Apr 9, 2020

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
Copy link
Owner

arnodelorme commented Apr 10, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants