[FieldTrip] Fieldtrip error
Schoffelen, J.M. (Jan Mathijs)
janmathijs.schoffelen at donders.ru.nl
Thu Aug 28 08:50:00 CEST 2025
Dear Natálie,
Perhaps the following may be helpful:
https://www.fieldtriptoolbox.org/faq/preproc/datahandling/convert_dataformat/<https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.fieldtriptoolbox.org%2Ffaq%2Fpreproc%2Fdatahandling%2Fconvert_dataformat%2F&data=05%7C02%7Cfieldtrip%40science.ru.nl%7C55e126f8477642a02f0c08dde5ff1be1%7C084578d9400d4a5aa7c7e76ca47af400%7C1%7C0%7C638919606030284504%7CUnknown%7CTWFpbGZsb3d8eyJFbXB0eU1hcGkiOnRydWUsIlYiOiIwLjAuMDAwMCIsIlAiOiJXaW4zMiIsIkFOIjoiTWFpbCIsIldUIjoyfQ%3D%3D%7C0%7C%7C%7C&sdata=I3xqQhkthtSp2%2Fth0FBTRZalw%2FjLEIGrWo%2BBen1Xq2A%3D&reserved=0>
Long story short: I think you need to call ft_write_data(filename, data_to_save.trial{1}, …), i.e. the second argument into the function should be a numeric matrix, not a data structure.
I agree that the received error message is a bit cryptic. It would be nice if somebody took up the challenge to build a ‘check’ early into ft_write_data to verify that the dat variable is a matrix and/or make the docstring a bit more informative (nudge, nudge to the reader).
Best wishes,
Jan-Mathijs
On 26 Aug 2025, at 18:43, Natalie via fieldtrip <fieldtrip at science.ru.nl> wrote:
Hi all,
I would really appreciate your help with the error below. I keep getting it after fix trials. I uploaded the script as well.
* The exact error message:
* Forcing data to be real and of class double before saving...
Error using write_edf (line 58)
Cannot write complex-valued data
Error in ft_write_data (line 745)
write_edf(filename, hdr, dat);
* My MATLAB version: MATLAB Version: 9.8.0.1323502 (R2020a)
* My FieldTrip version: stating that it is "revision unknown", downloaded on 11.08.2025
* My operating system: Microsoft Windows 10 Pro Version 10.0 (Build 19045)
Thank you for any help.
Kind Regards,
Natálie Šejvlová
<Untitled.m>_______________________________________________
fieldtrip mailing list
https://mailman.science.ru.nl/mailman/listinfo/fieldtrip
https://doi.org/10.1371/journal.pcbi.1002202
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.science.ru.nl/pipermail/fieldtrip/attachments/20250828/ee6188ca/attachment.htm>
More information about the fieldtrip
mailing list