# h5ln

Link an object to another one

## Calling Sequence

                h5ln(obj, linkname, destobj [, hard])
                h5ln(obj, linkname, destname [, hard])
                h5ln(obj, linkname, destfile, destname)
                h5ln(filename, location, linkname, destname [, hard])
                h5ln(filename, location, linkname, destfile, destname)

## Arguments

obj

  a H5Object

linkname

  a string giving the link name

destobj

  a H5Object

destfile

  a string giving the destination filename

hard

  a boolean

filename

  a string giving the filename

location

  a string giving the location in the file

## Description

Create a hard, soft or external link. When destfile is given, it is always an external link. By default hard is set to false, so by default a soft link is created.

Soft links can be created even if the target does not exist.

## Examples

    // 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]);
    h5group(b, "BGrp");
    h5write(b("/BGrp"), "BDset", 11:18);
    h5close(b)

    // We create a second group and add a link
    h5group(a, "Grp_2");
    h5ln(a, "Hard_Link", "/Grp_1/Dset_1", %t)
    h5ln(a, "Soft_Link", "/Grp_1/Dset_1")
    h5ln(a, "External_Link", TMPDIR  +"/test1.h5", "/BGrp")

    // We check
    h5dump(a)

    // Check the external link
    a.root.External_Link.BDset.data

    // We have finished so we free all the resources
    h5close(a);

## See Also

- h5open

## History

5.5.0
HDF5 module introduced.