Contents

function exists = h4exists(file, variable)

H4EXISTS check if object exists in HDF4 file

Inputs

Outputs

arguments
  file (1,1) string {mustBeFile}
  variable (1,1) string {mustBeNonzeroLengthText}
end

exists = false;

try
  sds = hdfinfo(file).SDS;
  i = string(sds.Name) == variable;
  exists = any(i);
catch e
  if e.identifier ~= "MATLAB:imagesci:h5info:unableToFind"
    rethrow(e)
  end
end