Problem reading hdf5 file (Error in h5read (line 59); Error using genvarname (line 53))

4 Ansichten (letzte 30 Tage)
Hello matlab community! I have trouble reading a hdf5 file using h5read(). The funny thing is that the exact same code used to work, but now even the old (and for months unmodified) stuff doesn't work any more. I'm sure this is something little and stupid but trying and searching and googling hasn't gotten me anywhere so far. The fact that even the old pieces of code don't work anymore makes me think that it's some library thing or so, but I just don't see or find it. I hope somebody can help me. Here's my code:
clear all
filename='\eSpectra170712.h5';
dataset='/600s_Picoquantlaser_20MHz_intensity6_TriggerDividedBy16';
t_factor = h5readatt(filename,strcat(dataset,'/events/'),'FIELD_2_FACTOR'); % this works
h5info(filename) % this works
%h5disp(filename) %this works
events=h5read(filename, strcat(dataset,'/events/')); % this does not work!
What I get in the Command Window is the following:
ans =
Filename: '\\XXX\XXX\XXX\eSpectra170712.h5'
Name: '/'
Groups: [2x1 struct]
Datasets: []
Datatypes: []
Links: []
Attributes: [4x1 struct]
Error using genvarname (line 53)
First input argument, VARNAME, must be either a string or a cell array of strings.
Error in h5read (line 59)
[data,var_class] = h5readc(Filename,Dataset,start,count,stride);
Error in test (line 10)
events=h5read(filename, strcat(dataset,'/events/'));
Any help is highly appreciated!
  2 Kommentare
Mukul Rao
Mukul Rao am 20 Jul. 2017
Bearbeitet: Mukul Rao am 20 Jul. 2017
Hi,
I have a few clarifying questions -
  • Did the file change at any point in time?
  • Did the version of MATLAB change?
  • If you place a breakpoint on line 53 in getvarname.m, what do you observe for the value of the variable "varnameCell"
per isakson
per isakson am 5 Aug. 2017
See the free program HDFView from The HDF Group It's perfect to inspect the content of HDF files.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Stephan Heinrich
Stephan Heinrich am 2 Jul. 2018
I just realized that I never posted the solution to my problem. In the end it seemed to be due to some library / function related conflict. I deleted all my folders from the path where MATLAB looks for functions and it worked again.
(Very belayed) thanks to all, who tried to help me!

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by