NeuroJSON / easyh5

EasyH5 Toolbox - An easy-to-use HDF5 data interface (loadh5 and saveh5) for MATLAB
BSD 3-Clause "New" or "Revised" License
12 stars 10 forks source link

Error when running saveh5.m without rootname #13

Closed abrahamzv closed 1 year ago

abrahamzv commented 1 year ago

I just downloaded the toolbox, but ran into some issues when running the example script. Whenever I run saveh5 without providing a rootname, line 93 of saveh5 returns an error. Perhaps the problem is that regexp(rootname,'/$') returns [] instead of a 'false' when rootname does not end wiht '/'?

Steps to reproduce:

data2hdf=1:3
saveh5(data2hdf,'test.h5');

Returns error:

Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY or ALL functions to reduce operands to logical scalar values.

Error in saveh5 (line 93)
if(~isfield(opt,'rootname') && regexp(rootname,'/$')) 

It works fine when providing a rootname, eg:

data2hdf=1:3
saveh5(data2hdf,'test.h5', 'RootName', 'test');

Matlab version: 2022a and 2019a

Best regards, Abraham