[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 mEvalMFile(URL
MFileURL) 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 mEvalMFile(String
MFilePath) 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 mEvalString(String
evalString) 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 mBoolEvalString(String
evalString) The function will return the boolean value of the scalar boolean expression specified in evalString. |
| Remove Variable in Workspace | void mClear(String
NameString) Removes the MATLAB workspace variable given by NameString. |
| Clear Workspace | void mClearAll() Removes all from the MATLAB workspace. |
| Get Matrix from Workspace | String mGetArray(String
MatrixName) 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 mGetArray(String
MatrixName, String m,
String n) 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 mGetString(String
MatrixName, String m ) 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 mPutArray(String
MatrixName) 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 mMatrix2LaTeX() 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 mLaTeX2Matrix(String
LaTeXString) 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 mGetM() Function returns the number of rows of the matrix stored in the plugin matrix storage. |
| Get Matrix Number of Columns | int mGetN() Function returns the number of columns of the matrix stored in the plugin matrix storage. |
| Set User Level | void mSetUserLevel(String
UserLevel) The user level value will be set internal in the plugin and stored in the MATLAB workspace variable UserLevel. |
| Get User Level | int mGetUserLevel() The user level value will be returned from the plugin storage. |
| Get MATLAB Version | double mGetMatlabVersion() Return the decimal number of the current MATLAB version. |
| Get Plugin Version | double mGetNPVCLabVersion() Returns the decimal number of the current Plugin version. |
| Get Java Version | double mGetJavaVersion() Returns the decimal number of the current Plugin Java methods version. |
[VCLab-Main] [Software] [MATLAB Plugin]