C# Class MATLABfromCSharp.MatlabAccess

Datei anzeigen Open project: osisoft/PI-to-MATLAB-Utility Class Usage Examples

Public Methods

Method Description
GetWorkspaceData ( string name, string workspace, object &val ) : void

Grab data from the workspace.

MatlabStartup ( ) : void

Starts with Program, either connects to COM-Enabled Matlab or starts a Matlab File.

The call "enableservice('AutomationServer',true);" COM-enables Matlab and ensures it doesn't close with the program.

isMatlabOpen ( ) : bool

Checks to see if Matlab is Open. (if matlab is null).

isVariableInWorkspace ( string name ) : bool

Checks the Matlab workspace for the variable name, so no data is Overwritten.

modifyMatlabName ( string varName ) : string

Make UserInput Matlab-Friendly and Check for Unique Variable Name 1) UserInput-MatlabFriendly - Remove punctuation and numbers at start 2) Check Unique Variables - check Matlab workspace and Log System

plotMatlabVariables ( string varName ) : void

Plots data the time vs. the unique variable name. Example of calling matlab methods from C#.

removeMatlabVariable ( string varName ) : void

Removes the variable from Matlab Workspace along with the timespace.

Only called when the log is editted.

sendDataToMatlab ( string varName, double dblInput ) : void

Send the array of doubles to Matlab.

sendDataToMatlab ( string varName, string strInput ) : void

Send a array of strings to Matlab.

Method Details

GetWorkspaceData() public static method

Grab data from the workspace.
public static GetWorkspaceData ( string name, string workspace, object &val ) : void
name string the name of the variable in the Matlab workspace.
workspace string the workspace name, (generally "base")
val object out the object from Matlab.
return void

MatlabStartup() public static method

Starts with Program, either connects to COM-Enabled Matlab or starts a Matlab File.
The call "enableservice('AutomationServer',true);" COM-enables Matlab and ensures it doesn't close with the program.
public static MatlabStartup ( ) : void
return void

isMatlabOpen() public static method

Checks to see if Matlab is Open. (if matlab is null).
public static isMatlabOpen ( ) : bool
return bool

isVariableInWorkspace() public static method

Checks the Matlab workspace for the variable name, so no data is Overwritten.
public static isVariableInWorkspace ( string name ) : bool
name string The variable name being checked for.
return bool

modifyMatlabName() public static method

Make UserInput Matlab-Friendly and Check for Unique Variable Name 1) UserInput-MatlabFriendly - Remove punctuation and numbers at start 2) Check Unique Variables - check Matlab workspace and Log System
public static modifyMatlabName ( string varName ) : string
varName string Either user-input name or attribute name
return string

plotMatlabVariables() public static method

Plots data the time vs. the unique variable name. Example of calling matlab methods from C#.
public static plotMatlabVariables ( string varName ) : void
varName string unique variable name
return void

removeMatlabVariable() public static method

Removes the variable from Matlab Workspace along with the timespace.
Only called when the log is editted.
public static removeMatlabVariable ( string varName ) : void
varName string The name of the variable in Matlab.
return void

sendDataToMatlab() public static method

Send the array of doubles to Matlab.
Thrown when matlab is closed and no connection.
public static sendDataToMatlab ( string varName, double dblInput ) : void
varName string The Unique variable name.
dblInput double Passed Array of Data.
return void

sendDataToMatlab() public static method

Send a array of strings to Matlab.
Thrown when matlab is closed and no connection.
public static sendDataToMatlab ( string varName, string strInput ) : void
varName string The unique variable name.
strInput string Passed Array of Data.
return void