fix in h5readatt_octave handling float or double attributes
parent
52889f71cb
commit
ccdb47a4cb
|
@ -65,13 +65,32 @@ DEFUN_DLD (h5readatt_octave, args, nargout, "h5readatt_octave(<File_Name>,<DataS
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t numVal = H5Aget_storage_size(attr)/sizeof(float);
|
size_t numVal = H5Aget_storage_size(attr)/H5Tget_size(type);
|
||||||
float value[numVal];
|
double value[numVal];
|
||||||
if (H5Aread(attr, H5T_NATIVE_FLOAT, value)<0)
|
if (H5Tget_size(type)==sizeof(float))
|
||||||
|
{
|
||||||
|
float f_value[numVal];
|
||||||
|
if (H5Aread(attr, H5T_NATIVE_FLOAT, f_value)<0)
|
||||||
{
|
{
|
||||||
error("h5readatt_octave: reading the given Attribute failed");
|
error("h5readatt_octave: reading the given Attribute failed");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
for (size_t n=0;n<numVal;++n)
|
||||||
|
value[n] = f_value[n];
|
||||||
|
}
|
||||||
|
else if (H5Tget_size(type)==sizeof(double))
|
||||||
|
{
|
||||||
|
if (H5Aread(attr, H5T_NATIVE_DOUBLE, value)<0)
|
||||||
|
{
|
||||||
|
error("h5readatt_octave: reading the given Attribute failed");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error("h5readatt_octave: reading the given Attribute failed: unknown type");
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
||||||
H5Aclose(attr);
|
H5Aclose(attr);
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
|
|
Loading…
Reference in New Issue