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?
Maria Jose Palancares Sosa
Maria Jose Palancares Sosa 2021 年 7 月 14 日
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 件のコメント

Sandra Chimeumanu Meshack
Sandra Chimeumanu Meshack 2021 年 8 月 12 日
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 日

2 投票

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.
MathWorks Supported Compilers Team
MathWorks Supported Compilers Team 2024 年 9 月 11 日
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 日

サインインしてコメントする。

カテゴリ

製品

リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by