Start and Stop Spreadsheet Link and MATLAB
Start Spreadsheet Link and MATLAB Automatically
When installed and configured according to the instructions in Add-In Setup, the Spreadsheet Link™ and MATLAB® software automatically start when you start a Microsoft® Excel® session.
Start Spreadsheet Link and MATLAB Manually
Select Tools > Macro.
In Excel 2007, click the View or Developer tab, and then click the Macros button.
In Excel 2010, click the View menu and select Macros on the Excel toolstrip, and then click View Macros.
Enter
matlabinitinto the Macro Name/Reference field.Click Run. The MATLAB Command Window button appears on the Microsoft Windows® taskbar.
Connect to an Already Running MATLAB Session
By default, Spreadsheet Link starts a new MATLAB session. Alternatively, it can connect to an already running MATLAB session.
Note
If several versions of MATLAB are installed on your computer, Spreadsheet Link always uses the last registered version. If you try to connect to an already running MATLAB session that is not the last registered version, Spreadsheet Link starts a new MATLAB session. Spreadsheet Link does not connect to the existing one. To change the last registered version, see Startup Errors.
To connect a new Excel session to an already running MATLAB session:
In MATLAB, enter the following command:
enableservice('AutomationServer',true)This command converts a running MATLAB session into an Automation server.
Start a new Excel session. It automatically connects to the running MATLAB session.
Alternatively, you can start MATLAB as an automation server
from the beginning. To start MATLAB as an automation server,
use the automation command-line option:
matlab -automation
This command does not start MATLAB in a full desktop mode.
To do so, use the -desktop option:
matlab -automation -desktop
If you always use MATLAB as an automation server, modify the shortcut that you use to start MATLAB:
Right-click your MATLAB shortcut icon. (You can use the icon on your desktop or in the Windows Start menu.)
Select Properties.
Click the Shortcut tab.
Add
-automationin the Target field. Remember to leave a space betweenmatlab.exeand-automation.Click OK.
For details, see Manually Create Automation Server.
Specify the MATLAB Startup Folder
MATLAB starts in the MATLAB root folder and completes
the initialization. After starting, MATLAB changes to the Spreadsheet Link MATLAB startup
folder. For details about specifying the startup folder, see MLStartDir.
Stop Spreadsheet Link and MATLAB
If you started the Spreadsheet Link and MATLAB software from the Excel interface:
To stop both the Spreadsheet Link and MATLAB software, close the Excel session as you normally would.
To stop the Spreadsheet Link and MATLAB software and leave the Excel session running, enter the
=MLClose()command into an Excel worksheet cell. You can use theMLOpenormatlabinitfunction to restart the Spreadsheet Link and MATLAB sessions manually.
If you connected an Excel session to an existing MATLAB session, close Excel and MATLAB sessions separately. Closing one session does not automatically close the other.