



% Initiate a conversation with Microsoft Excel
% for the spreadsheet 'forecast.xls'.
channel = ddeinit('excel', 'forecast.xls');

% Set up a hot link between a range of cells in Excel
% and the matrix 'x'.
% If successful, display the matrix.
rc = ddeadv(channel, 'r1c1:r5c5', 'disp(x)', 'x');

% Given the channel assigned to a conversation,
% send a command to Excel.
rc = ddeexec(channel, '[formula.goto("r1c1")]');

% Send a 5-by-5 identity matrix to Excel.
rc = ddepoke(channel, 'r1c1:r5c5', eye(5));

% Request a matrix of cells from Excel.
mymtx = ddereq(channel, 'r1c1:r10c10');

% Terminate the DDE conversation.
rc = ddeterm(channel);

% Release the hot link established in the ddeadv example.
rc = ddeunadv(channel, 'r1c1:r5c5');

% Release a hot link with default format and a timeout value.
rc = ddeunadv(chan, `r1c1:r5c5', [], 6000);

