MATLAB Answers

How do read .npy files in matlab?

853 views (last 30 days)
Hello.
In matlab it is possible to read the extension .npy, or in its absence the extension .LVM of Labview.

Accepted Answer

Andrew Knyazev
Andrew Knyazev on 11 Jun 2019
https://github.com/kwikteam/npy-matlab
  4 Comments

Sign in to comment.

More Answers (2)

Toon Weyens
Toon Weyens on 16 Feb 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)
  1 Comment
Sandra Chimeumanu Meshack
Sandra Chimeumanu Meshack on 12 Aug 2021
i tried this, it seems to work but it's asking me to allow_pickle=True

Sign in to comment.


Cam Salzberger
Cam Salzberger on 14 Feb 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

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!