I have some important data (structured array) in Matlab with .mat extension which I want to open in python, I tried almost every blog from stack-overflow to access my data but still unsuccessful I need not just to load the data in python but to work on them after making numpy arrays. I loaded them in Windows but unable to access sub-arrays.
I used the following command:
import numpy as np, h5py, scipy.io
scipy.io.loadmat('/media/sibte/DATA and SOFTWARE/DATA/recovery/GENERAL SOFTWARE/MATLAB/2_Programming Files/MATLAB Files/ASTRONOMICAL DATA and WORKING on it/NVSS.mat')
this result in the following error:
Traceback (most recent call last):
File "<pyshell#1>", line 1, in <module>
scipy.io.loadmat('/media/sibte/DATA and SOFTWARE/DATA/recovery/GENERAL SOFTWARE/MATLAB/2_Programming Files/MATLAB Files/ASTRONOMICAL DATA and WORKING on it/NVSS.mat')
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio.py", line 126, in loadmat
matfile_dict = MR.get_variables(variable_names)
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio4.py", line 394, in get_variables
hdr, next_position = self.read_var_header()
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio4.py", line 350, in read_var_header
hdr = self._matrix_reader.read_header()
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio4.py", line 121, in read_header
raise ValueError('O in MOPT integer should be 0, wrong format?')
ValueError: O in MOPT integer should be 0, wrong format?
Then I used the h5py command to load:
f = h5py.File('/media/sibte/DATA and SOFTWARE/DATA/recovery/GENERAL SOFTWARE/MATLAB/2_Programming Files/MATLAB Files/ASTRONOMICAL DATA and WORKING on it/NVSS.mat','r+')
this results in following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
f = h5py.File('/media/sibte/DATA and SOFTWARE/DATA/recovery/GENERAL SOFTWARE/MATLAB/2_Programming Files/MATLAB Files/ASTRONOMICAL DATA and WORKING on it/NVSS.mat','r+')
File "/usr/lib/python2.7/dist-packages/h5py/_hl/files.py", line 207, in __init__
fid = make_fid(name, mode, userblock_size, fapl)
File "/usr/lib/python2.7/dist-packages/h5py/_hl/files.py", line 81, in make_fid
fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
File "h5f.pyx", line 71, in h5py.h5f.open (h5py/h5f.c:1806)
IOError: unable to open file (File accessibilty: Unable to open file)
I have spent several days in loading this data, I have many other data in .mat format to access but fed up with this deadlock
NOTE: I am using IDLE-Python-2.7.6 shell on UBUNTU-14.04
I had worked on these file in Matlab-R2010a v7.1 on Windows-7
Any help regarding this issue?