[VCLab-Main] [Software] [Matlab Plugin][Basic Plugin Example]


Basic Plugin Example

This Basic Plugin Example shows

  • plugin embedding
  • execution of an M-file on page load
  • execution of an M-file by the mEvalMFile method
  • execution of command strings by the mEvalString method

Embedding and execution of bsp1.m bsp1.m
<EMBED SRC="bsp1.m" NAME="matlab" WIDTH="500" HEIGHT="300"> % example 1
a=[1,2;3,4]
b=[2,2]
Below is the plugin window. On load the file bsp1.m has been executed.
The output shows the definition of the matrices a and b.
Execution of an M-File bsp2.m

Pressing the button  will execute the M-file bsp2.m.

% example 2
c=b*a
Source code:
<FORM>Pressing the button <INPUT TYPE="button" NAME="EvalMFileButton" VALUE="mEvalMFile('bsp2.m')" ONCLICK="document.matlab.mEvalMFile('bsp2.m')"> will execute the M-file bsp2.m.</FORM>
MATLAB Command Execution

Pressing the button  will execute the MATLAB statement a*eig(a).

Source code:
<FORM>Pressing the button INPUT TYPE="button" NAME="EvalStringButton" VALUE="mEvalString('a*eig(a)')" ONCLICK="document.matlab.mEvalString('a*eig(a)')">will execute the MATLAB statement a*eig(a)</FORM>

[VCLab-Main] [Software] [Matlab Plugin][Basic Plugin Example]


©CS 1996, 1997, 1998, 2001