Execute MATLAB function in Automation server
HRESULT Feval([in] BSTR functionname, [in] long nargout, [out] VARIANT* result, [in, optional] VARIANT arg1, arg2, ...)
Feval(String functionname, long numout, arg1, arg2, ...) As Object
result = Feval(h,'functionName',numout,arg1,arg2,...)
result = Feval(h,'functionName',numout,arg1,arg2,...)
executes
MATLAB® function functionName
in the Automation server attached
to h
. The function name is case-sensitive. If
functionName
does not have input arguments, consider calling
Execute
instead.
COM functions are available on Microsoft® Windows® systems only.
Indicate the number of outputs returned by the function in a
1
-by-1
double
array, numout
. The server returns output
from the function in the cell array, result
.
You can specify as many as 32 input arguments to be passed to the function. These
arguments follow numout
in the Feval
argument
list. The following table shows ways to pass an argument.
Passing Mechanism | Description |
---|---|
Pass the value itself | To pass any numeric or character value, specify the value in
the a = Feval(h,'sin',1,-pi:0.01:pi); |
Pass a client variable | To pass an argument assigned to a variable in the client, specify the variable name alone: x = -pi:0.01:pi;
a = Feval(h,'sin',1,x); |
Reference a server variable | To reference a variable defined in the server, specify the
variable name followed by an equals ( PutWorkspaceData(h,'x','base',-pi:0.01:pi); a = Feval(h,'sin',1,'x='); MATLAB does not reassign the server variable. |
To display the output from Feval
in the client window,
assign a return value.
Execute
| GetCharArray
| GetFullMatrix
| PutCharArray
| PutFullMatrix