Content Prev Next Down

Running a SigmaPlot Macro
Syntax spmacro(macroTypemacroString)
See Also spitem , spopen

Description
Runs a SigmaPlot macro that is either defined within SigmaPlot or a text file. The character row vector, macroType must equal the value name, or file. Th second argument, macroString must be a character row vector. If the value of macroType equals name then macroString must be the name of a macro that exists with SigmaPlot. If the value of macroType equals file, the value of macroString must be the name of a text file that contains a valid SigmaPlot macro.

The ipacks\SP\macros directory of your distribution contains several SigmaPlot macros. Files of the form SP* are used by the SigmaPlot interface toolbox and should not be modified.

Examples

Running Macros Defined in SigmaPlot
If SigmaPlot is not running and at the O-Matrix command prompt you enter
     include example\demo\fft2dx.oms
O-Matrix will run the 2-D FFT example from the O-Matrix distribution and create a surface plot within O-Matrix. If you continue the example by entering
     ssurface(G)
     spmacro("name", "Insert Graphs into Word")
SigmaPlot will create a filled surface plot of the solution, G and invoke the wizard for pasting the graph into Microsoft Word.

You can also run macros that you have created and saved to the SigmaPlot macro library. If you use the SigmaPlot macro recorder to create a new macro, GrayScaleContour, you can run GrayScaleContour from O-Matrix. If SigmaPlot is not running and you enter the following commands at the O-Matrix prompt,
     clear
     x = -1:1:5
     z = x*x'/10 * rand(7,7)/4
     scontour(z)
     spmacro("name", "GrayScaleContour")
O-Matrix will create a contour plot in SigmaPlot using the default Fill Color and then change the spectrum to a gray scale.

Running Macros Defined in Text Files
File names specified by macroString may either be relative, or completely qualified names.

The setDataMacro.txt file in the ipacks\SP\examples directory of your distribution contains a SigmaPlot macro to set the data for two cells of a worksheet. If SigmaPlot is not running and you enter the following at the O-Matrix prompt
     clear
     fileName = [OM_INSTALL, "\ipacks\SP\examples\setDataMacro.txt"]
     spopen
     spmacro("file", fileName)
SigmaPlot will open with a new worksheet containing the data specified in setDataMacro.txt.