MATLAB Interface

STK and MATLAB can be integrated using connectors that can be downloaded from AGI's website or by accessing STK's COM interface.

Advantages of STK-MATLAB Integration

You can integrate STK and MATLAB to automate, extend or visualize your analysis.

Automate

You can operate STK or MATLAB from the other to access the capabilities of both tools without the need to switch between application sessions. For example:

  • You can use MATLAB to modify a scenario or object for trade study analysis and bring those results into MATLAB for further analysis.
  • You can use STK to evaluate mission or relative geometric conditions such as range or inter-visibility between objects or S/N ratio. When a specific figure of mission effectiveness or geometric condition is met, MATLAB can automatically begin additional functions.

Extend

STK and MATLAB can be used together to extend or augment the types of analysis that you can perform with just one of them alone. For example:

  • Using STK's satellite propagators in your MATLAB analysis.
  • Defining a customer sensor in MATLAB and then loading it into STK.
  • Utilizing MATLAB post-processing on STK-generated data.
  • Creating a MATLAB custom vector plugin for STK.

Visualize

MATLAB users can use STK's 2D and 3D visualization to view any geo-referenced or geometric MATLAB data, such as position or attitude information or an antenna gain pattern. Large data sets from STK can be loaded into MATLAB, where you can use its native 2D and 3D plotting capabilities to help understand the data and communicate the results.

The MATLAB OLE automation interface cannot handle conversion of return types of IUnknown based interfaces.

Connecting STK and MATLAB

There are two interfaces to connect STK and MATLAB:

  1. MexConnect - this interface communicates over TCP/IP
  2. COM - this interface communicates over a COM connection

To choose the best interface to use, determine what you plan to accomplish with your STK MATLAB integration and then expand the decision tree below and follow the steps provided.

STK MATLAB Integration Decision TreeClosed

Connecting STK and MATLAB

MexConnect

For each supported version of MATLAB, AGI produces a connector, which can be downloaded from AGI's website.

Click here for instructions on setting up the MATLAB Interface.

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

COM

The COM connection works with any version of MATLAB and is compatible with 64 bit and 32 bit versions. You can get started with AGI's MATLAB code samples in the STK Programming Interface Help. You can use the snippets to connect to STK and start customizing.

Operating STK from MATLAB

For general command line help and a list of demos for MexConnect, type 'help STK' at the MATLAB command prompt.

For general help using the COM interface, you can use MATLAB Intellisense. Enter a period followed by a tab to invoke the Intellisense menu.

Refer to the Integrating STK with MATLAB page for more information about operating STK from MATLAB.

Starting STK Engine from MATLAB currently only works in 2020b(9.9) or higher. There is a symbol conflict between fortran runtime dlls in the two products.

If you are using STK 12.7 or STK 12.7.1, starting STK Engine from MATLAB only works in 2022b (9.13) or higher.

Operating MATLAB from STK

If you are experiencing problems connecting to MATLAB with MexConnect, refer to the STK Message Viewer for help analyzing the source of the problems.