Non-Spotfire data in MATLAB

When you use one of the non-Spotfire APIs to send a MATLAB script to the server, you can specify input data objects which are converted into MATLAB objects and available as MATLAB input variables with the specified names.

When you run a MATLAB script using one of the non-Spotfire APIs, the last expression evaluated by the script is captured (by accessing the MATLAB special variable ans), and returned as the result of the script execution. This process can be counter-intuitive, because the ans variable is not set when a simple variable is evaluated. Thus, the following script would return 3, because the last expression is 1+2:

  x=10+5;1+2;x;

The following script returns the value of variable x, namely 15:

  x=10+5;1+2;ans=x;