File Exchange

image thumbnail


version 1.0.0 (1.93 KB) by Luca Amerio
Reads HDF5 files and returns data in a structure

1 Download

Updated 27 Mar 2019

View License

Reads HDF5 files and returns data in a structure

Handles data, attributes and char arrays.
Reads nested groups recursively and return nested structures.

Cite As

Luca Amerio (2021). HDF2Struct (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (4)

per isakson

@apple, After replacing line 76-77 with

if not(isvarname( name{i} )) % any(name{i}==' ')
name_new=strrep(name{i},' ','');
if not(isvarname( name_new )) && not(isempty( name_new ))
name_new = matlab.lang.makeValidName( name_new );

HDF2Struct reads the NASA hdf-file.

>> data = HDF2Struct('ATL06_20190223232535_08780212_001_01.h5',false);
>> whos data
Name Size Bytes Class Attributes
data 1x1 236149170 struct

The name, "ANC38-06", caused the problem.


Great work! code is concise and runs fast!

MATLAB Release Compatibility
Created with R2019a
Compatible with R2016a to R2018b
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!