Hello.
In matlab it is possible to read the extension .npy, or in its absence the extension .LVM of Labview.

 채택된 답변

Andrew Knyazev
Andrew Knyazev 2019년 6월 11일
편집: Walter Roberson 2024년 12월 20일

14 개 추천

댓글 수: 5

Maria Magnusson
Maria Magnusson 2020년 2월 17일
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 2020년 9월 10일
Excellent!! Thankyou very much...
Cinar Gulleroglu
Cinar Gulleroglu 2020년 12월 7일
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?
Super useful, thanks!
Svetlana Piner
Svetlana Piner 2022년 3월 18일
Best response from my point of view!

댓글을 달려면 로그인하십시오.

추가 답변 (3개)

Toon Weyens
Toon Weyens 2021년 2월 16일

10 개 추천

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

i tried this, it seems to work but it's asking me to allow_pickle=True
Leonardo da Silva Costa
Leonardo da Silva Costa 2021년 12월 13일
편집: Leonardo da Silva Costa 2021년 12월 13일
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 2022년 3월 7일
편집: Varun Vasudevan 2022년 3월 7일
This works. Thanks Leonardo :)
Grzegorz Klosowski
Grzegorz Klosowski 2022년 9월 8일
Good job. Thanks.
Mark Sie
Mark Sie 2023년 6월 18일
Help me greatly thank u
Mehrdad
Mehrdad 2024년 7월 5일
thank you
Stephen23
Stephen23 2024년 12월 20일
"the easiest thing would be to create a Python script such as the one below, and run that."
This is easier:

댓글을 달려면 로그인하십시오.

Grace Kepler
Grace Kepler 2023년 11월 7일
편집: Stephen23 2024년 12월 20일

3 개 추천

Yes, use code like this.
x = py.numpy.load('data.npy')

댓글 수: 3

Mike Jonson
Mike Jonson 2024년 9월 10일
편집: Mike Jonson 2024년 9월 10일
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 2024년 12월 20일
"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:

댓글을 달려면 로그인하십시오.

Cam Salzberger
Cam Salzberger 2019년 2월 14일

1 개 추천

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

Johann Martinez
Johann Martinez 2022년 2월 23일
One more reason to stop using Matlab. Python indeed has libraries to make use Matlab.
Stephen23
Stephen23 2024년 12월 20일
편집: Stephen23 2024년 12월 20일

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

제품

릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by