简体   繁体   English

使用 C# 删除 hdf5 数据集

[英]Deleting hdf5 dataset using C#

I using HDF5 database and wanted to delete and update dataset, using below code I am creating group structure and created one dataset but now stuck on deleting dataset.我使用 HDF5 数据库并想删除和更新数据集,使用下面的代码我正在创建组结构并创建了一个数据集,但现在坚持删除数据集。

code below:下面的代码:

public void DeleteDataset()
{
  string filename = @"C:\Users\sagar_aute\Desktop\test2.h5";
  var dset = dsets.First();
  try
  {
    var fileId = Hdf5.CreateFile(filename);
    Hdf5.WriteDataset(fileId, "/test", dset);
    long groupId1 = Hdf5.CreateOrOpenGroup(fileId, "Location");
    long groupId2 = Hdf5.CreateOrOpenGroup(groupId1, "Cabinet");
    long groupId3 = Hdf5.CreateOrOpenGroup(groupId2, "Drawer");
    long groupId4 = Hdf5.CreateOrOpenGroup(groupId3, "Folder");
    Hdf5.WriteDataset(groupId4, "/File", new double[10, 1]);
    //wanted to delete above dataset "File"
    Hdf5.CloseFile(fileId);
  }
  catch (Exception ex)
  {
     
  }
}

You may want to have a look at HDFql to help you managing HDF5 files in a high-level fashion.您可能想看看HDFql以帮助您以高级方式管理 HDF5 文件。 To delete dataset File stored in HDF5 file C:\Users\sagar_aute\Desktop\test2.h5 using HDFql in C# could be implemented as follows:要删除存储在 HDF5 File C:\Users\sagar_aute\Desktop\test2.h5中的数据集文件,使用 C# 中的 HDFql 可以实现如下:

HDFql.execute("DROP C:\Users\sagar_aute\Desktop\test2.h5 \"File\"");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM