Friday, July 31, 2009

ddeadv

Set up advisory link

Syntax

  • rc = ddeadv(channel,'item','callback')
    rc = ddeadv(channel,'item','callback','upmtx')
    rc = ddeadv(channel,'item','callback','upmtx',format)
    rc = ddeadv(channel,'item','callback','upmtx',format,timeout)

Description

ddeadv sets up an advisory link between MATLAB and a server application. When the data identified by the item argument changes, the string specified by the callback argument is passed to the eval function and evaluated. If the advisory link is a hot link, DDE modifies upmtx, the update matrix, to reflect the data in item.

If you omit optional arguments that are not at the end of the argument list, you must substitute the empty matrix for the missing argument(s).

If successful, ddeadv returns 1 in variable, rc. Otherwise it returns 0.

Arguments


channel
Conversation channel from ddeinit.
item
String specifying the DDE item name for the advisory link. Changing the data identified by item at the server triggers the advisory link.
callback
String specifying the callback that is evaluated on update notification. Changing the data identified by item at the server causes callback to get passed to the eval function to be evaluated.
upmtx (optional)
String specifying the name of a matrix that holds data sent with an update notification. If upmtx is included, changing item at the server causes upmtx to be updated with the revised data. Specifying upmtx creates a hot link. Omitting upmtx or specifying it as an empty string creates a warm link. If upmtx exists in the workspace, its contents are overwritten. If upmtx does not exist, it is created.
format (optional)
Two-element array specifying the format of the data to be sent on update. The first element specifies the Windows clipboard format to use for the data. The only currently supported format is cf_text, which corresponds to a value of 1. The second element specifies the type of the resultant matrix. Valid types are numeric (the default, which corresponds to a value of 0) and string (which corresponds to a value of 1). The default format array is [1 0].
timeout (optional)
Scalar specifying the time-out limit for this operation. timeout is specified in milliseconds. (1000 milliseconds = 1 second). If advisory link is not established within timeout milliseconds, the function fails. The default value of timeout is three seconds.

Examples

Set up a hot link between a range of cells in Excel (Row 1, Column 1 through Row 5, Column 5) and the matrix x. If successful, display the matrix:

  • rc = ddeadv(channel, 'r1c1:r5c5', 'disp(x)', 'x');

Communication with Excel must have been established previously with a ddeinit command.

No comments:

Post a Comment