MATLAB: How to echo MATLAB commands from Spreadsheet Link EX in the MATLAB command window

commanddisplayechoexcellineoutputSpreadsheet Linkvba

I am calling MATLAB functions from Excel using Spreadsheetlink EX. I included DISP commands or finished expressions with ',' rather than ';' in order to display intermediate results. However the MATLAB command window does not show any outputs when calling MATLAB from Excel.

Best Answer

The ability to have Spreadsheet Link EX macros echo its commands in MATLAB's command window is not available in Spreadsheet Link EX 3.0.3 (R2009a).
Please consider the following workaround.
1. Use message box to display the result
you can add a code using MsgBox to the VBA program as follows.
 
MsgBox ("The output is" & Result)
Also , there is an example of displaying an error message in a message box in the following documentation.
· Display MATLAB Errors in VBA Macro
For the details of MsgBox, please refer to the external site.
2. Save the result as a file
In a MATLAB program, you can add functions to save to a file such as fopen / fprintf / fclose, and save the result as a file.