Created
September 2, 2017 06:11
-
-
Save jackhftang/94ddf16da35f12a3e9cc41a40ac0ea5b to your computer and use it in GitHub Desktop.
convert matlab .mat to .csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python3 | |
import scipy.io | |
import numpy as np | |
import sys | |
from os.path import basename, splitext | |
src = sys.argv[1] | |
data = scipy.io.loadmat(src) | |
dest = f'{splitext(basename(src))[0]}.csv' | |
for i in data: | |
if '__' not in i and 'readme' not in i: | |
np.savetxt((dest),data[i],delimiter=',') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment