mlink

mlink is a replacement for linkdata.

Limitation of Matlabs linkdata:
  • Slow to initialise, especially for large and complex GUI's
  • No easy way to exclude certain plots from the linked data.
  • Doesn't automatically deal with situations where plot variables are not at the root level (see below) in source workspace.
  • Doesn't work well with data stored in a class.
Key features of the linkdata:
  • Includes everything that is good with the default linkdata.
  • Much improved performance when using with large complex GUIs.
  • Data can be crosslinked (i.e. user brushes plot X v Y -> vars A and B also updated)
    • Note this requires that the variables are the same size -> so they can be index linked).
  • Can link to struct vars and/or data stored in a class.
See here for some screenshots on the capability - when used with the mbrush class.

The best way to understand how the linkdata is to download demo and run the example.

More examples are included in the licensed version.


Data Source Problems with LinkData

The inbuilt Matlab function linkdata expects data to be at the root workspace level - i.e. not in a struct, cell or a field in a class.

For example the following code fails:

    data.x = [0:10];

    data.y = data.x.^2;

    hplot = plot ( data.x, data.y );

    linkdata


This is due to the algorithm which is used in linkdata searches for variables which match the data in the plot - this is a high risk approach as the following code appears to work:

    xx = [0:10];

    yy = xx.^2;

    data.x = [0:10];

    data.y = data.x.^2;

    hplot = plot ( data.x, data.y );

    linkdata

The problem is that the plot will be updated by changes to xx and yy -> not the data from the structure data.