How Do I Configure the Matlab Interface?

From BESA® Wiki
Jump to: navigation, search
Module information
Modules BESA Research Basic or higher
Version 5.2 or higher

MATLAB must be installed

For step 2 (required for MATLAB versions 2009b and over), we need to know whether the 32-bit or 64-bit version of MATLAB is installed. We also need to know the path to the Matlab installation (e.g. "C:\Program Files\MATLAB\2009b\").


PATH environment variable

For versions 2009b and over, make sure that the path to the Win32 or Win64 folder in the MATLAB installation to the "PATH" environment variable is defined:

  • The path for the 64-bit version for Matlab 2009b is typically "C:\Program Files\MATLAB\R2009b\bin\win64". For the 32-bit version, the path is typically "C:\Program Files\MATLAB\R2009b\bin\win32".
  • Open the "System Properties" dialog by holding down the "Windows" key and pressing the "Pause" key at the same time.
    • In XP, the dialog is opened directly.
    • In Vista and Window 7, the key combination opens the "System Display". Click on the link "Change Settings".
    • In Windows 8, the key combination also opens the "System Display". Click on the link "Advanced system settings". Skip the step in this description, as you have already chosen the advanced settings.
  • Select the "Advanced" tab.
  • Press the "Environment Variables" button.
  • Under "System variables" click on the "Path" variable and then click "Edit". In the resulting dialog, enter a semicolon (;) at the end of the path string, and add the path after the semicolon.
  • Click "OK" to close and save the path variable. Click "OK" to close the "System Properties" dialog. When using Windows Vista/7/8, you will also need to close the "Control Panel" window afterwards.
  • Figure 1 Advanced system settings
  • Figure 2 Environment variables
  • Figure 3 Edit system variable


Additional configuration

(Only required after a change of your MATLAB configuration after installation of BESA Research)

During the installation process of BESA Research, the program "ConfigureBesaMatlabInterface.exe (or SetupBesaMatlabInterface.exe)" in the BESA Research root folder was executed. Run this program again when your MATLAB configuration has changed, e.g. after updating your MATLAB version.

In the dropdown list, select the Matlab version that you are using. This program performs two operations:

  • it copies the appropriate interface Dll to the BESA Research root folder and renames it to "BesaMatlab.dll" (32-bit version) or "BesaMatlab64.dll" (64-bit version), and
  • if you are using a 64-bit version it creates an entry in BESA.ini as follows:
[Matlab] 
Platform=64


Testing

  • Start BESA Research and check if Send to MATLAB is displayed in the File menu. If it is, the interface is set up correctly. (Note that the item will be grayed if no file is open in BESA Research.)
  • Test the interface: open a data file, mark a short (e.g. 1 s) time range, and select File / Send to Matlab to open the Export Dialog:
  • The Matlab window should open, and BESA Research will display a progress bar:
  • After the window closes, open the Matlab window, and type "Workspace" to open the workspace window, or "Desktop" to open the standard Matlab desktop.
  • Examine the "besa_channels" variable, which contains the data for the marked data segment.
  • Figure 4 Send marked segment to Matlab
  • Figure 5 Send to Matlab progress bar
  • Figure 6 Data exported from BESA Research to Matlab


Troubleshooting if the interface is not working after the above steps

If the File / Send to MATLAB... menu item is not shown, this means that either the path (step 2 above) is not defined properly, or that the interface Dll (BesaMatlab.dll or BesaMatlab64.dll) is not compatible with the currently installed version of Matlab.