Created
January 17, 2017 22:01
-
-
Save benkamphaus/153691aa9b2958fae888f74695d88c86 to your computer and use it in GitHub Desktop.
Use Python to dump a variable in a mat file into a numpy format delimited text file
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
# requires scipy and numpy: | |
# e.g., with: | |
# pip install scipy numpy | |
import sys | |
import scipy.io as sio | |
from numpy import savetxt | |
filein = sys.argv[1] | |
fileout = sys.argv[2] | |
arr_dict = sio.loadmat(filein) | |
try: | |
var = sys.argv[3] | |
arr = arr_dict[var] | |
savetxt(fileout, arr) | |
except: | |
print(arr_dict.keys()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment