We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5e7eef7 commit c841edfCopy full SHA for c841edf
matconverter.py
@@ -0,0 +1,24 @@
1
+import sys
2
+import scipy.io
3
+
4
+def mat_to_txt(mat_file, txt_file):
5
+ # Cargar el archivo .mat
6
+ data = scipy.io.loadmat(mat_file)
7
8
+ # Abrir el archivo de salida
9
+ with open(txt_file, "w") as f:
10
+ for key, value in data.items():
11
+ # Saltar metadatos de MATLAB
12
+ if key.startswith("__"):
13
+ continue
14
+ f.write(f"Variable: {key}\n")
15
+ f.write(f"Contenido:\n{value}\n\n")
16
17
+if __name__ == "__main__":
18
+ if len(sys.argv) != 3:
19
+ print("Uso: python mat_to_txt.py entrada.mat salida.txt")
20
+ else:
21
+ mat_file = sys.argv[1]
22
+ txt_file = sys.argv[2]
23
+ mat_to_txt(mat_file, txt_file)
24
+ print(f"Archivo {mat_file} convertido en {txt_file}")
0 commit comments