Install Connector | Install Connector for New MATLAB Version | Connect to Different Version of MATLAB | Uninstall MATLAB Version | Troubleshooting | Refresh MATLAB Path Technical Notes | Valid STK-MATLAB Configurations

Using a MATLAB Connector to Interface with STK

This guide provides instructions for setting up the interface between MATLAB and STK 11 using a MATLAB connector.

AGI recommends using STK's COM interface to integrate STK and MATLAB. Please refer to the MATLAB Interface help topic for an explanation of the differences between connectors and the COM interface.

Prerequisites

  • A supported version of MATLAB
  • STK 11 installed
  • STK Integration license
  • A valid STK-MATLAB configuration. For diagrams of valid 32-bit and 64-bit configurations of MATLAB and STK, click here.

Supported MATLAB Versions

R2015b is the last MATLAB release with Windows 32-bit support.

These MATLAB Versions... ... in this STK MATLAB Connector... ...support this STK Version
R2008a, R2010a through R2017b 1.0.9 11.2.1, 11.3
R2008a, R2010a through R2017a 1.0.8 11.2.1, 11.3
R2008a, R2010a through R2016b 1.0.8 STK 11
R2008a, R2010a through R2016b 1.0.7 STK 11
R2008a, R2010a through R2016a 1.0.6 STK 11
R2008a, R2010a through R2015b 1.0.5 STK 11
R2008a, R2010a through R2014a 1.0.5 STK 10
R2008a, R2010a through R2014a 1.0.4 STK 10
R2008a, R2010a through R2013a 1.0.3 STK 10
R2008a, R2010a through R2012b 1.0.1 STK 10

For a list of supported MATLAB versions, review the version.txt file in the Matlab Connector install folder.

Installing an STK MATLAB Connector

The STK MATLAB Connector is the interface that enables communication between MATLAB and STK.

To install the connector:

  1. Browse to the MATLAB_Connectors or MATLAB_Connectors_X64 folder on the STK DVD, click on setup.exe and follow the install instructions.)
  2. To confirm that the installed version of MATLAB is connectable, start STK, go to the Edit menu and select Preferences->MATLAB.
  3. The MATLAB file path is automatically configured to find AGI M-files and MEX files. If you need to reset the MATLAB file path, click Refresh MATLAB Path. (You can also reset the MATLAB file path by selecting Refresh MATLAB Path (32-bit) or (64-bit) from the Start->All Programs-> STK Support Tools menu.)

Installing a Connector for a New MATLAB Version

  1. Before installing a connector for a new MATLAB version, check to confirm that the new version of MATLAB is supported and a connector exists for that version.
  2. Run the latest MATLAB Connector install to ensure that the updated connector is available.
  3. Install the new version of MATLAB.
  4. To confirm that the installed version of MATLAB is connectable, start STK, go to the Edit menu, and select Preferences->MATLAB.
  5. Using the STK Preferences MATLAB page, you can only connect to the most recent version of MATLAB installed. See Connecting to a Different Version of MATLAB to change the version you are connected to.

  6. If needed, click Refresh MATLAB Path to reset the MATLAB file path.

Connecting to a Different Version of MATLAB

If you have more than one version of MATLAB installed and you would like to connect to the version installed prior to the last one installed, perform the following steps in MATLAB:

  1. Run “matlab /regserver” from the command prompt, with administrator privileges, from the bin folder of the version of MATLAB you want to use. You may need to use the –c option to specify a different MATLAB license file if the administrator is not licensed to run MATLAB.
  2. Make sure you have the connectors installed for the version of MATLAB you want to run.
  3. Browse to the MATLAB_Connectors or MATLAB_Connectors_X64 folder on the STK DVD, click on setup.exe and follow the install instructions. (You can also download the latest MATLAB Connector setup.exe.)
  4. To confirm that the chosen version of MATLAB is connectable, start STK and go to the Edit menu, and select Preferences->MATLAB.
  5. If needed, click Refresh MATLAB Path to reset the MATLAB file path.

Uninstalling a MATLAB Version

If the uninstalled MATLAB version was registered as the automation server and you have another version of MATLAB still installed on the computer where STK resides, follow the steps in Connecting to a Different Version of MATLAB.

Troubleshooting the STK MATLAB Interface

Edit Menu->Preferences->MATLAB does not show an Installed Version of MATLAB

Check the following:

  • Run the MATLAB Connector Refresh utility by going to Edit Menu->Preferences->MATLAB in STK and clicking Refresh MATLAB Path, or by selecting Refresh MATLAB Path (32-bit) or (64-bit) from the Start->All Programs-> STK Support Tools menu.
  • If that does not enable the connector, check for the latest STK MATLAB Connector install. If it is supported, download and follow the install instructions. Start STK and check Edit Menu->Preferences->MATLAB. If it is not supported, contact AGI Technical Support.

AGI MEX and/or MFiles are not found by MATLAB

If you alter the MATLAB search path and then save the change, the AGI MEX and MFiles may be removed from the search path. To restore the MATLAB search path to include the AGI MEX and MFiles, run the Connector Refresh utility.

Compatibility Issue with Multiple Versions of STK and/or MATLAB

Changes made to the system path enabling STK 9 and MATLAB to work together may cause STK 11 to become incompatible with other versions of MATLAB. To correct this issue for STK 11, back out all changes made to the system path for the STK 9 and MATLAB interface. Contact AGI Technical Support if this does not solve your MATLAB compatibility issue.

Refresh MATLAB Path Tool Technical Notes

The Refresh MATLAB Path tool adds the default MATLAB user area, the location of the AGI MEX files, and location of the AGI M-files to the AGI:defaultuserworkfolder preference. This preference is overwritten each time you click Refresh MATLAB Path. If you override the default user area provided by MATLAB, you must set the "AGI:userworkfolder" preference.

The AGI-provided startup.m file is automatically executed each time MATLAB starts. The startup.m file extracts preferences configured by the Refresh MATLAB Path tool to add the STK MEX file folders and user work folder to the path.

If you use your own startup.m file, you should rename your startup.m file and set the 'AGI:userstartup' preference to point to this renamed file.

After running the Refresh MATLAB Path tool, type 'help startup' from the MATLAB prompt to show the options available.

AeroToolbox for MATLAB

The AeroToolbox is part of the STK-MATLAB interface that provides access to STK conversion routines (position/velocity, orbit elements, reference frame transformation) and dynamic geometry calculation methods (vehicle propagators, position converters, etc). Help information on the AeroToolbox can be found inside MATLAB by typing help aerotoolbox. Help for each function is found by typing help {functionNameHere}

Valid STK-MATLAB Configurations

The following diagrams illustrate the valid configurations between STK and MATLAB.

STK/STK Engine and MATLAB Engine Configurations

STK/STK Engine and MATLAB Desktop Configurations