This repository has been archived on 2026-10-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
2026-09-22 11:52:03 +02:00

32 lines
770 B
Python

#!/usr/bin/python
import json
from load_matrix import loadmat
from pymatreader import read_mat
import os
def main(f):
matFile = os.path.join(
"/home/nao/Documents/Backups/Participant results/Sam/", f)
mat = loadmat(matFile)
results = mat["results"]
jsonFile = os.path.join(
"/home/nao/Documents/Backups/Participant results/Sam/", os.path.splitext(f)[0] + ".json")
with open(jsonFile, 'w+') as fl:
fl.write(json.dumps(results, indent=4, sort_keys=True))
fl.close()
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('f', help='.mat file to be created into json')
args = parser.parse_args()
main(args.f)
print '--- Operation Completed ---'