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
Editada: Walter Roberson el 20 de Dic. de 2024

14 votos

5 comentarios

Maria Magnusson
Maria Magnusson el 17 de Feb. de 2020
I copied readNPY.m and readNPYheader.m from there and could then easily read npy-images into matlab.
Thankyou very much! /Maria
Carlos Theran Suarez
Carlos Theran Suarez el 10 de Sept. de 2020
Excellent!! Thankyou very much...
Cinar Gulleroglu
Cinar Gulleroglu el 7 de Dic. de 2020
Is it possible for you to show or briefly explain how to use this readNPY.m and readNPYheader.m/how to integrate this to our codes?
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 (3)

Toon Weyens
Toon Weyens el 16 de Feb. de 2021

10 votos

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)

7 comentarios

Sandra Chimeumanu Meshack
Sandra Chimeumanu Meshack el 12 de Ag. de 2021
i tried this, it seems to work but it's asking me to allow_pickle=True
Leonardo da Silva Costa
Leonardo da Silva Costa el 13 de Dic. de 2021
Editada: Leonardo da Silva Costa el 13 de Dic. de 2021
In my case I had to do something like this
X = np.load('./dataset/dataset_Xs.npy')
savemat('./dataset/dataset_Xs.mat', {'X': X})
Varun Vasudevan
Varun Vasudevan el 7 de Mzo. de 2022
Editada: Varun Vasudevan el 7 de Mzo. de 2022
This works. Thanks Leonardo :)
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
Mehrdad
Mehrdad el 5 de Jul. de 2024
thank you
Stephen23
Stephen23 el 20 de Dic. de 2024
"the easiest thing would be to create a Python script such as the one below, and run that."
This is easier:

Iniciar sesión para comentar.

Grace Kepler
Grace Kepler el 7 de Nov. de 2023
Editada: Stephen23 el 20 de Dic. de 2024
Yes, use code like this.
x = py.numpy.load('data.npy')

3 comentarios

Mike Jonson
Mike Jonson el 10 de Sept. de 2024
Editada: Mike Jonson el 10 de Sept. de 2024
No. That'd be how to do it with python, not in MATLAB.
Hi Mike,
Did you try it? This works for me. Note that "py." is prepended to the normal Python command "numpy.load('data.npy')".
>> x=py.numpy.load('data.npy')
x =
Python ndarray:
1 2 3
4 5 6
7 8 9
Stephen23
Stephen23 el 20 de Dic. de 2024
"No. That'd be how to do it with python, not in MATLAB."
No, that is how to do it from MATLAB, not from Python:

Iniciar sesión para comentar.

Cam Salzberger
Cam Salzberger el 14 de Feb. de 2019

1 voto

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

2 comentarios

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.
Stephen23
Stephen23 el 20 de Dic. de 2024
Editada: Stephen23 el 20 de Dic. de 2024

Iniciar sesión para comentar.

Categorías

Productos

Versión

R2018b

Etiquetas

Preguntada:

el 14 de Feb. de 2019

Editada:

el 20 de Dic. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by