
function [root] = rd_h5(filename);

root.info = h5info(filename);
for ii = 1:length(root.info.Datasets)
	try
		varname = root.info.Datasets(ii).Name;
		data = h5read(filename,['/' varname]);
		root.(varname) = data;
	catch
	end
end

for ii = 1:length(root.info.Groups)
	try
		group.name = root.info.Groups(ii).Name;
		group.info = h5info(filename,group.name);
		for jj = 1:length(group.info.Datasets)
			varname = group.info.Datasets(jj).Name;
			root.(group.name).(varname) = h5read(filename,['/' group.name '/' varname]);
		end
	catch
	end
end

