Why does using MLGetMatrix not update the destination cells in Excel when using Excel Link 2.2 (R14)?

3 views (last 30 days)
I used the MLGetMatrix macro in one of my Excel cells. The associated MATLAB session for Excel Link is open and has a variable called b whose value is some number. I input the command into cell A3:
=mlgetmatrix("b","D3")
and then hit Enter. The cell changes to zero to indicate successful retrieval of the variable 'b'. However the cell D3 is still empty and is not updated.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
This happens because Excel does not update the sheet with the results of running MLGetMatrix until the F9 key is pressed. This is why the '0' appears but the sheet does not reflect the retrieved matrix.
To correct this, press the F9 key on the keyboard after entering the formula. This instructs MATLAB to update all the cells in the workbook. Alternatively you may use Shift+F9 to update only the current sheet.
For more information on this keyboard shortcut please search for the term 'F9' (without quotes) in the Excel help system.
To avoid having to hit F9 repeatedly, you may setup Excel to automatically update when a formula has changed. Please note that this may cause undesirable results, for example, if a variable is cleared in MATLAB and then Excel attempts to retrieve it. So the best option would be to use the F9 or the Shift-F9 keys.
To setup Excel to automatically update its cells:
1) In Excel, go to the Tools menu -> Options
2) Choose the 'Calculation' tab.
3) Choose The 'Automatic' option under the Calculation heading.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!