I want to load 38 .mat files into a dictionary to hold them all. the .mat files are named subject1 to subject38 The code I tried is a simple for loop
import scipy.io as sio
data = {}
for i in range(1, 38):
data["data{}".format(i)] = sio.loadmat('subject{}.mat'.format(i))
the error I'm getting is:
Traceback (most recent call last): File "D:/senior project/python/dataAqu.py", line 7, in data["data{0}".format(i)] = sio.loadmat('subject{0}.mat'.format(i)) File "C:\Users\mamdo\AppData\Roaming\Python\Python27\site-packages\scipy\io\matlab\mio.py", line 208, in loadmat matfile_dict = MR.get_variables(variable_names) File "C:\Users\mamdo\AppData\Roaming\Python\Python27\site-packages\scipy\io\matlab\mio5.py", line 292, in get_variables res = self.read_var_array(hdr, process) File "C:\Users\mamdo\AppData\Roaming\Python\Python27\site-packages\scipy\io\matlab\mio5.py", line 252, in read_var_array return self._matrix_reader.array_from_header(header, process) File "mio5_utils.pyx", line 675, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 705, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 778, in scipy.io.matlab.mio5_utils.VarReader5.read_real_complex File "mio5_utils.pyx", line 450, in scipy.io.matlab.mio5_utils.VarReader5.read_numeric File "mio5_utils.pyx", line 355, in scipy.io.matlab.mio5_utils.VarReader5.read_element File "streams.pyx", line 194, in scipy.io.matlab.streams.ZlibInputStream.read_string File "pyalloc.pxd", line 9, in scipy.io.matlab.pyalloc.pyalloc_v MemoryError
for i in range(1,39):. Regarding the error message: how big are the.matfiles?