EDF reading: edfread gives timetable; possible to get struct?

7 visualizzazioni (ultimi 30 giorni)
My friend and I are working with the same function that utilizes '[hdr data] = edfread(file)'. The code depends on edfread() returning the outputs as struct, not timetable.
When he runs the file it appropriately returns as struct. However, when I run it, it returns as timetable.
Troubleshooting I've tried:
  • Using table2struct() converts to struct including the columns of the timetable, but it is missing other pieces of data (e.g., hdr.samples)
  • Downloading the old function edfRead solved the issue and allowed me to unpack correctly. However, this file is no longer supported.
  • We are both using 2021a and both have signal processing toolbox installed
My understanding is that matlab now has the built in function 'edfread()' and it returns timetables. Although I've found a potential workaround by using an outdated/deprecated file, it still confuses me that he's able to get the struct.
  1 Commento
dpb
dpb il 24 Lug 2021
Undoubtedly your colleague still has the FEX version and has it where it aliases the builtin version.
This would happen transparently if he's actually using running in the same directory as the m-file, for instance, for just one way.
Ask him to run
which -all edfread
and see what it returns.
Just because TMW has chosen to implement a builtin version of similar functionality, if it doesn't meet your requirements there's certainly nothing wrong with continuing to use the FEX submission. And, it's no more (or less) supported by TMW now than before; TMW doesn't support anything on FEX; that's totally up to the submitter and the community feedback.
I'd say go for what works for you and submit a bug report/enhancement request for the lost functionality (depending upon whether what is lost is really totally lost/not returned data that is in the file or just a translation problem from the returned table to the struct).
I've never run across EDF files so I "know nuthink!" a la Sgt Schultz regarding them or their structure.

Accedi per commentare.

Risposta accettata

dpb
dpb il 24 Lug 2021
Modificato: dpb il 25 Lug 2021
Undoubtedly your colleague still has the FEX version and has it where it aliases the builtin version.
This would happen transparently if it's in the same directory as the calling m-file, for instance, for just one way.
Ask him to run
which -all edfread
and see what it returns.
Just because TMW has chosen to implement a builtin version of similar functionality, if it doesn't meet your requirements there's certainly nothing wrong with continuing to use the FEX submission. And, it's no more (or less) supported by TMW now than before; TMW doesn't support anything on FEX; that's totally up to the submitter and the community feedback.
I'd say go for what works for you and submit a bug report/enhancement request for the missing functionality (depending upon whether what is missing is really totally lost/not returned data that is in the file or just a translation problem from the returned table to the struct).
I've never run across EDF files so I "know nuthink!" a la Sgt Schultz regarding them or their structure.
  2 Commenti
Andrew M
Andrew M il 25 Lug 2021
Solved! With a little more context:
With the new edfread(), the output is a timetable containing data. It used to be a struct containing fields with the data, as well as fields specifying metadata.
To get the metadata now you must use the function edfinfo(). Note the names of the output variables are different from the outputs from the old FEX file, but they do contain all the same datapoints.
I think the most likely explanation in my specific case is that my friend inexplicably has the FEX version.
MR27
MR27 il 3 Ago 2022
Hi
Does anybody know how to force MATLAB to read the file using the OLD edfread function? i have the old version stored in the same directory as my script, but whenever i run it, it defaults to the newer version, which won't work with the script
Thanks!

Accedi per commentare.

Più risposte (1)

Peter Perkins
Peter Perkins il 26 Lug 2021
Andrew, FEX issues aside, it's possible that the DataRecordOutputType parameter to edfread may help. But it's also possible that going with timetables would make your code easier and simpler. Just sayin'.
  1 Commento
Andrew M
Andrew M il 26 Lug 2021
I completely agree - I think timetable is the ideal output. It just took me a long time to understand how/why he was getting metadata out of the function and I wasn't!

Accedi per commentare.

Categorie

Scopri di più su EEG/MEG/ECoG in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by