{"id":21428,"library":"hdf5storage","title":"hdf5storage","description":"Utilities to read/write Python types to/from HDF5 files, including MATLAB v7.3 MAT files. Current version: 0.2.2. Release cadence: irregular.","status":"active","version":"0.2.2","language":"python","source_language":"en","source_url":"https://github.com/skjerns/hdf5storage","tags":["hdf5","matlab","v7.3","io","serialization"],"install":[{"cmd":"pip install hdf5storage","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"scipy.io.loadmat does not support v7.3 files.","wrong":"from scipy.io import loadmat","symbol":"loadmat","correct":"from hdf5storage import loadmat"},{"note":"scipy.io.savemat cannot write v7.3 files.","wrong":"from scipy.io import savemat","symbol":"savemat","correct":"from hdf5storage import savemat"},{"note":"Alias not required but works; correct import is fine.","wrong":"import hdf5storage as h5s","symbol":"hdf5storage","correct":"import hdf5storage"}],"quickstart":{"code":"import hdf5storage\nimport numpy as np\ndata = {'array': np.array([1,2,3]), 'string': 'hello'}\n# Write to v7.3 MAT file\nhdf5storage.savemat('example.mat', data, format='7.3')\n# Read back\nloaded = hdf5storage.loadmat('example.mat')\nprint(loaded['array'])","lang":"python","description":"Write and read a simple dictionary with an array and a string to a MATLAB v7.3 file."},"warnings":[{"fix":"Migrate to h5py (direct HDF5) or mat73 (MATLAB v7.3 specific).","message":"The 'hdf5storage' library is in maintenance mode; consider using 'h5py' or 'mat73' for v7.3 files.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Use Python 3.10 or later.","message":"Python 3.10+ only; drops support for Python <3.10.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Always pass format='7.3' for MATLAB compatibility.","message":"savemat with default options writes HDF5-compatible files but MATLAB may not read nested structures correctly without specifying 'format'.","severity":"gotcha","affected_versions":"all"},{"fix":"Specify encoding explicitly: loadmat('file.mat', encoding='utf-8')","message":"String arrays are stored as HDF5 datasets; when reading, returned strings may be bytes. Use encoding='utf-8' in loadmat if needed.","severity":"gotcha","affected_versions":"<0.2.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Run: pip install hdf5storage","cause":"Library not installed","error":"ModuleNotFoundError: No module named 'hdf5storage'"},{"fix":"Ensure file is a valid HDF5/v7.3 file. Use h5py or check file header.","cause":"File is not HDF5 or v7.3 format","error":"OSError: Unable to open file (file signature not found)"},{"fix":"Convert object arrays to supported types (e.g., list, string) or use h5py.","cause":"savemat cannot handle arrays of Python objects directly","error":"ValueError: Cannot write object of type <class 'numpy.ndarray'> with dtype object"},{"fix":"Convert bytes to string (e.g., .decode()) or use 'h5py' with vlen bytes data type.","cause":"Trying to write bytes without encoding","error":"TypeError: can't write bytes to HDF5 dataset"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}