Reading HDF5 with dynamic filters

26 次查看(过去 30 天)
Ben Dichter
Ben Dichter 2022-3-20
回答: Ninad 2024-1-19
I am trying to read an HDF5 file that uses a zstd filter, and I am having trouble setting the HDF5_PLUGIN_PATH variable. Here is what I have tried:
>> !export HDF5_PLUGIN_PATH=/Users/bendichter/opt/miniconda3/lib/python3.9/site-packages/hdf5plugin/plugins
>> !echo $HDF5_PLUGIN_PATH
/Users/bendichter/opt/miniconda3/lib/python3.9/site-packages/hdf5plugin/plugins
>> setenv("HDF5_PLUGIN_PATH", "/Users/bendichter/opt/miniconda3/lib/python3.9/site-packages/hdf5plugin/plugins")
>> getenv("HDF5_PLUGIN_PATH")
'/Users/bendichter/opt/miniconda3/lib/python3.9/site-packages/hdf5plugin/plugins'
>> h5read("zstd.h5","/data")
Error using h5readc
The HDF5 library encountered an error and produced the following stack trace information:
H5PL__find_plugin_in_path can't open directory: /usr/local/hdf5/lib/plugin
Error in h5read (line 93)
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);
Why is MATLAB looking in /usr/local/hdf5/lib/plugin? That directory does not exist, and I have tried two different ways to tell MATLAB to look an a different directory. What am I doing wrong?
  4 个评论
Ben Dichter
Ben Dichter 2022-3-23
@Benjamin Thompson so do you have any ideas how I might fix this? I am not trying to read a .mat file
Science Machine
Science Machine 2023-4-18
try loading path before starting matlab?

请先登录,再进行评论。

回答(1 个)

Ninad
Ninad 2024-1-19
Hi Ben,
As per my understanding you want to read an HDF5 file in MATLAB and you are unable to set HDF5_PLUGIN_PATH variable using the "setenv()" function.
Please go through the latest version of MATLAB documentation "Import HDF5 Files":
It clearly states that you need to set the HDF5_PLUGIN_PATH environment variable to the folder containing the installed plugin binary file before you start MATLAB.
On Windows® — Set the environment variable using System Properties > Advanced > Environment Variables, and then start MATLAB.
Hope this helps.
Regards
Ninad

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by