diff --git a/+stdlib/+hdf5nc/private/coerce_ds.m b/+stdlib/+hdf5nc/private/coerce_ds.m index f84fd13..c2d5c5b 100644 --- a/+stdlib/+hdf5nc/private/coerce_ds.m +++ b/+stdlib/+hdf5nc/private/coerce_ds.m @@ -14,10 +14,16 @@ return end +if dtype == "float64" + dtype = "double"; +elseif dtype == "float32" + dtype = "single"; +end + switch dtype case "" return - case {'float64', 'double', 'float32', 'single', 'int8', 'int16', 'int32', 'int64','uint8', 'uint16', 'uint32', 'uint64'} + case {'double', 'single', 'int8', 'int16', 'int32', 'int64','uint8', 'uint16', 'uint32', 'uint64'} A = cast(A, dtype); case 'char' A = string(A); diff --git a/+stdlib/TestHDF5.m b/+stdlib/TestHDF5.m index 64a628c..9995f70 100644 --- a/+stdlib/TestHDF5.m +++ b/+stdlib/TestHDF5.m @@ -5,7 +5,9 @@ end properties (TestParameter) -type = {'single', 'double', 'int8', 'int16', 'int32', 'int64', 'uint8', 'uint16', 'uint32', 'uint64'} +type = {'single', 'double', 'float32', 'float64', ... + 'int8', 'int16', 'int32', 'int64', ... + 'uint8', 'uint16', 'uint32', 'uint64'} vars = {'A0', 'A1', 'A2', 'A3', 'A4'} str = {"string", 'char'} end @@ -224,7 +226,15 @@ function test_coerce(tc, type) tc.assumeThat(basic, IsFile) -tc.verifyClass(h5read(basic, vn), type) +if type == "float32" + vtype = "single"; +elseif type == "float64" + vtype = "double"; +else + vtype = type; +end + +tc.verifyClass(h5read(basic, vn), vtype) end