Move an object
h5mv(srcobj [, srcloc], destobj [, destloc]) h5mv(srcobj [, srcloc], destfile, destloc) h5mv(srcfile, srcloc, destobj [, destloc]) h5mv(srcfile, srcloc, destfile, destloc)
a H5Object
a H5Object
a string giving the source location
a string giving the destination location
a string the source filename
a string giving the destination filename
Move an object to another place (same file or not). This command is equivalent to h5cp
followed by h5rm
.
Before moving a newly created object, the file must be flushed.
// We create a HDF5 file a = h5open(TMPDIR + "/test.h5"); b = h5open(TMPDIR + "/test1.h5"); // We create a group and a dataset h5group(a, "Grp_1"); h5write(a.root.Grp_1, "Dset_1", [1 2 ; 3 4]); // We flush the file to be sure that the modifications // will be taken into account when the move will occur h5flush(a); // Create a group and a dataset in b h5group(b, "BGrp"); h5write(b("/BGrp"), "BDset", 11:18); h5close(b) // Now we copy Dset_1 to Dset_2 located under root h5mv(a.root.Grp_1, "Dset_1", a, "Dset_2") // Copy BDset to a dataset under Grp_1 h5mv(TMPDIR +"/test1.h5", "/BGrp/BDset", a.root.Grp_1) // We have finished so we free all the resources h5close(a); | ![]() | ![]() |
Version | Description |
5.5.0 | HDF5 module introduced. |