How do read .npy files in matlab?

1.213 visualizaciones (últimos 30 días)
Juan Pablo Restrepo Uribe
Juan Pablo Restrepo Uribe el 14 de Feb. de 2019
Respondida: Grace Kepler el 7 de Nov. de 2023
Hello.
In matlab it is possible to read the extension .npy, or in its absence the extension .LVM of Labview.

Respuesta aceptada

Andrew Knyazev
Andrew Knyazev el 11 de Jun. de 2019
https://github.com/kwikteam/npy-matlab
  5 comentarios
Maria Jose Palancares Sosa
Maria Jose Palancares Sosa el 14 de Jul. de 2021
Super useful, thanks!
Svetlana Piner
Svetlana Piner el 18 de Mzo. de 2022
Best response from my point of view!

Iniciar sesión para comentar.

Más respuestas (4)

Toon Weyens
Toon Weyens el 16 de Feb. de 2021
If you have access to Python, the easiest thing would be to create a Python script such as the one below, and run that. It will find all .npz files in the current directory and convert that to .mat.
from scipy.io import savemat
import numpy as np
import glob
import os
npzFiles = glob.glob("*.npz")
for f in npzFiles:
fm = os.path.splitext(f)[0]+'.mat'
d = np.load(f)
savemat(fm, d)
print('generated ', fm, 'from', f)
  5 comentarios
Grzegorz Klosowski
Grzegorz Klosowski el 8 de Sept. de 2022
Good job. Thanks.
Mark Sie
Mark Sie el 18 de Jun. de 2023
Help me greatly thank u

Iniciar sesión para comentar.


Cam Salzberger
Cam Salzberger el 14 de Feb. de 2019
Hello Juan,
I don't believe that either of those file formats are natively supported in MATLAB, but you can always check File Exchange to see if anyone has written an importer for them. A quick search did not turn up anything for NPY, but LVM turned up this one. If you have any questions about that File Exchange package, it's best to direct them to the author of the package.
-Cam
  1 comentario
Johann Martinez
Johann Martinez el 23 de Feb. de 2022
One more reason to stop using Matlab. Python indeed has libraries to make use Matlab.

Iniciar sesión para comentar.


ROuntrance Krumph
ROuntrance Krumph el 11 de Nov. de 2022
You cannot do so. MATLab® is proprietary software and cannot run "open-source" code .
It shall be destined to go the way of the Pheonix (Arizona)
size(IRIS); IRIS(size)
Unrecognized function or variable 'IRIS'.

Grace Kepler
Grace Kepler el 7 de Nov. de 2023
Yes, use code like this.
>> x=py.numpy.load('data.npy')

Categorías

Más información sobre Call Python from MATLAB en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by