ratal / mdfreader

Read Measurement Data Format (MDF) versions 3.x and 4.x file formats in python
Other
169 stars 73 forks source link

export_to_matlab() error importing scipy.savemat() #181

Closed darth3PO closed 4 years ago

darth3PO commented 4 years ago

Python version

3.7.4 (default, Aug 9 2019, 18:34:13) [MSC v.1915 64 bit (AMD64)]

Platform information

Windows-10-10.0.16299-SP0

Numpy version

1.16.5

mdfreader version

4.0

scipy version

1.3.1

Description

Error when trying to import savemat from scipy import savemat

Successfully imported by changing scipy to scipy.io from scipy.io import savemat

from mdfreader.py:

    def export_to_matlab(self, file_name=None):
        """Export mdf data into Matlab file preferrably in format 7.3

        Parameters
        ----------------
        file_name : str, optional
            file name. If no name defined, it will use original mdf name and path

        Notes
        --------
        This method will dump all data into Matlab file but you will loose below information:
        - unit and descriptions of channel
        - data structure, what is corresponding master channel to a channel.
        Channels might have then different lengths.
        Dependency: hdf5storage, scipy
        """
        # export class data structure into .mat file
        try:
            from hdf5storage import savemat
        except ImportError:
            warn('hdf5storage module not found')
            try:
                from scipy.io import savemat
            except ImportError:
                warn('scipy also module not found')
                return
ratal commented 4 years ago

Thanks ! Corrected in master