Sending a Trace to MATLAB

The MATLAB API enables INTViewer to send & receive data, execute commands, scripts and functions on a MATLAB environment. This walkthrough will go through the basics of sending one trace to MATLAB.

Reviewing Dependencies

This MATLAB example module will requires the following modules that are part of the INTViewer platofrm:

  • IntviewerCore
  • MatlabCore
  • Seismic2D
  • SeismicData
  • Viewer2D
  • Utilities API (provided with NetBeans)
  • UI Utilities API (provided with NetBeans)
  • Lookup API (provided with NetBeans)

Create a new NetBeans module.

  • Click File -> New Project
  • In the New Project wizard, select NetBeans Modules from the Categories list and Module from the Projects list and click Next >
  • For Project Name, specify matlabexample
  • Select option Standalone Module and make sure to specify the INTViewer platform in the NetBeans Platform field.
  • Click Next > and specify matlabexample for the Code Name Base
  • Click on Finish.

Configuring your module

  • In the Projects tree, right-click on the module matlabexample and select Properties from the list.
  • Under Categories, select Libraries.
  • Select Java Platform JDK1.7.
  • Click on the Add button next to Module Dependencies
  • In the list, select IntviewerCore, Lookup API, MatlabCore, Seismic2D, SeismicData, Utilities API and Viewer2D, and click OK.
  • Click OK in the Project Properties Dialog.

Creating the trace processing class.

  • In the matlabexample package right and select New -> Java Class from the contextual menu.
  • Name The class SendFirstTraceAction and click Finish.
  • Make the class extend SystemAction and implement LookupListener and add the imports
  • Implement all abstract methods, this will create the basic structure of the class for you.
  • Add a new global variable and the constructor below.

Note: The layerResult will contain the currently selected seismic layer in INTViewer.

  • Create a new method called sendFirstTrace and as shown below
  • Fill in the methods created for you previously as shown below

Adding the action to the layer.xml

  • Right click on the matlabexample package and select New -> Other
  • In Module Development click on XML Layer and click Next.
  • Then click Finish.
  • Modify the layer.xml to look like below. This will create a new Menu called MatlabExample with the action we created in it in INTViewer.

Running the project

  • Run the project, once loaded click on the Connect to MATLAB button.
  • Once connected, the status of the icon will change.
  • Load seismic data into a new XSection window, then select MatlabExample -> Send first trace

The trace should now be in the MATLAB environment.