我试图使用HDF5文件(Version1.5.3)覆盖现有的数据集,特别是HDF5包。我环顾四周寻找了一段时间来寻找答案,但令人惊讶的是,我没有发现任何有用的东西--所以我们来看看:修改HDF5文件中现有数据集的首选方法是什么?
发布于 2022-08-16 21:58:41
如果试图向数据集分配新值,则HDF5.jl将出错,但可以使用:索引运算符覆盖它:
# create the dataset if it doesn't already exist
g["my_dataset"] = [1, 2, 3]
# will fail because the dataset already exists
g["my_dataset"] = [4, 5, 6]
# overwrites the existing dataset with the new data
g["my_dataset"] = [7, 8, 9]注意,新数据集和旧数据集的大小必须相等。否则,您将不得不删除现有的数据集并重新创建它。
https://stackoverflow.com/questions/65831962
复制相似问题