[VCLab-Main] [Software] [MATLAB Plugin]

The MATLAB Plugin performs communications with MATLAB. It provides mechanisms to do computations in the MATLAB Workspace, to emulate the MATLAB command window output and to put and get data to and from the Workspace. |

**Embedding
---- Visibility ---- Keys and Parameters Methods ---- Examples
**

Loading a page with an embedded MATLAB Plugin will start MATLAB in the background on the first load. Depending on the plugin parameters MATLAB will execute statements, which will come with the plugin load. A Java class with a set of methods for MATLAB communication and MATLAB execution on the page are available.

The Plugin consists of the dynamic link library **NPVCLab.dll** and the Java class **VCLabPlugin.class**, which both reside in the browser
plugin directory. The software is installed with the VCLab installer, as shown
in the installation guide.

The plugin can be embedded using different parameters, which influence
the startup and visual layout. If the MATLAB command output should be
visualized, the embedding by

```
<EMBED
SRC="
```

*file.m*" WIDTH=400
HEIGHT=350 NAME="*name*">

may be used. The plugin will load the **M**-file *file.m*
specified by the SRC key and MATLAB will execute
it. The output will be printed in the plugin window, for which the size by
HEIGHT and WIDTH is
given.

It is also possible, not to specify an **M**-file but to specify the
MIME-type of the plugin. This is performed by the TYPE key

```
<EMBED
TYPE="application/x-matlab"
WIDTH=400 HEIGHT=350
NAME="
```

*name*">

This enables the browser to load this plugin. There is no way at least so far to specify a plugin by its name.

In standard plugin embedding the keyword HIDDEN determines the visibility of the plugin window. Due to internal causes, this key is not allowed with this plugin. Instead of this key, the user key DISPLAY must be used. If the parameter is set to "false" the plugin's window is inactive, but the plugin is still running in the background.

```
<EMBED
SRC="
```

*file.m*" DISPLAY="false"
WIDTH=5 HEIGHT=5
NAME="*name*">

This mechanism enables to keep the contact with the MATLAB engine without showing output. The WIDTH and HEIGHT parameter can be set to a small value. This makes it easy to hide the output of MATLAB from the user.

The plugin provides public Java methods that can be called from Java applets or JavaScript. This allows to implement dynamical actions and computations in MATLAB. The plugin contains an internal matrix storage for buffered communication between MATLAB and the Java methods. This storage can be accessed by someJava methods as shown below.

Operation |
Syntax |
---|---|

M-file
Execution |
` void ` This method loads an M- or
MM-file over the web and executes it in the MATLAB workspace. For the
MATLAB working directory see the source key syntax in
the EMBED tag. ` void ` This method executes an M- or
MM-file in the MATLAB workspace given by the MFilePath. The
MFilePath specifies a file path on the client computer system. For the
MATLAB working directory see the source key syntax in
the EMBED tag. |

Command
Execution |
` void ` The string specified by evalString will be executed in the MATLAB workspace. This is the remote
version of the MATLAB eval command. |

Boolean Expression
Evaluation |
` boolean ` The function will return the boolean value of the scalar boolean expression specified in evalString. |

Remove Variable in
Workspace |
` void ` Removes the MATLAB workspace variable given by NameString. |

Clear Workspace |
` void ` Removes all from the MATLAB workspace. |

Get Matrix from
Workspace |
` String ` This function gets the matrix specified by MatrixName from the workspace and stores it in the plugin
matrix storage. The function returns this matrix described by a string in the
LaTeX array notation as specified by the HotEqn applet. |

Get a Scalar Variable from
Workspace |
` double ` This function gets the matrix specified by MatrixName from the workspace and stores it in the plugin
matrix storage. The function returns the (m,n)-element of the matrix. Low index
is 1. |

Get a Scalar String Variable from
Workspace |
` String ` This function gets the string matrix specified by MatrixName from the workspace and stores it converted into
equivalent double values in the plugin matrix storage. The function returns the
m-th element of the string matrix as a string. Low index is 1. |

Put Matrix to Workspace |
` boolean ` Puts the matrix stored in the plugin matrix storage to the workspace and assigns it the variable name given by MatrixName. If this operation is successful the function returns true,
otherwise false. |

Matrix to LaTeX
Conversion |
` String ` The function returns the matrix stored in the plugin matrix storage described by a string in the LaTeX array notation as specified by the HotEqn applet. |

LaTeX to Matrix
Conversion |
` void ` The array given in LaTeX notation in LaTeXString is converted to a matrix and stored in the plugin matrix
storage. |

Get Matrix Number of
Rows |
` int ` Function returns the number of rows of the matrix stored in the plugin matrix storage. |

Get Matrix Number of
Columns |
` int ` Function returns the number of columns of the matrix stored in the plugin matrix storage. |

Set User Level |
` void ` The user level value will be set internal in the plugin and stored in the MATLAB workspace variable UserLevel. |

Get User Level |
` int ` The user level value will be returned from the plugin storage. |

Get MATLAB Version |
` double ` Return the decimal number of the current MATLAB version. |

Get Plugin Version |
` double ` Returns the decimal number of the current Plugin version. |

Get Java Version |
` double ` Returns the decimal number of the current Plugin Java methods version. |

- Basic example with embedding, M-file and string execution
- MM-file execution example
- Miscellaneous functions example

[VCLab-Main] [Software] [MATLAB Plugin]

©CS 1996, 1997, 1998, 2001