Configuring a MATLAB engine

To use MATLAB™ software as a Spotfire Statistics Services engine, you must perform additional configuration steps for each Spotfire Statistics Services installation.

Prerequisites

MATLAB must be installed on the same machine as the server. For cluster installations, MATLAB must be installed on every machine where a server node is run. Spotfire Statistics Services has been tested on machines with MATLAB installed as an Individual - Standalone Named User. The only part of MATLAB that Spotfire Statistics Services requires is basic MATLAB. Other MATLAB toolkits are not required, but they can be installed on the machine.

For more information about tested versions, see the Spotfire Statistics Services System Requirements section of the support web site at http://support.spotfire.com/sr.asp.

On Microsoft Windows®, Spotfire Statistics Services normally would run as a Windows service. The properties window for a service contains a Log On tab specifying how the service process should be executed; either Log in as:/Local System account, or Log in as:/This account. When using Spotfire Statistics Services with MATLAB, you must use the Log in as:/This account option for MATLAB to detect the appropriate user license.

Procedure

  1. Edit the spserver.properties file to set engine.type=MATLAB.
    The properties file is located at SPSERVER_HOME/conf for a standalone installation or SPSERVER_SHARE/conf on a cluster. For more information, see engine.type
  2. Set the following property to identify the path to the MATLAB installation:
    Operating System Description
    Microsoft Windows Add -Dspserver.matlabhome=/path/to/MATLAB/install/dir to the Java options for the service. For more information, see Procrun
    UNIX/Linux Edit SPSERVER_HOME/init.d/spserver to specify SPSERVER_MATLABHOME=/path/to/MATLAB/install/dir.
    Note: MATLABHOME must be set to the MATLAB installation directory (for example, C:\Program Files\MATLAB\2020a\).
  3. Restart Spotfire Statistics Services.
  4. Test Spotfire Statistics Services with MATLAB by sending a simple MATLAB script to a Web browser. For example, use the following script (assuming the server is accessed via the URL http://myserver:8966/server_name) .
    http://myserver:8966/server_name/api/v8/expression/eval?cmd=
    struct('x',transpose(1:3),'y',100*transpose(1:3),'rnum',randn(3,1))
    If the server is running correctly, it should return XML for a data frame with three rows and three columns. It should also return text giving the MATLAB text output for the script.