eval
Evaluates the given expression.
Syntax
eval(A)
Inputs
- A
- Expression to be evaluated.
Outputs
- R
- Result of evaluated expression.
Examples
a=2
eval('1+a*3')
R = 7
R = eval('a=2')
disp(a)
R = 2
2
Discover new features and enhancements.
Discover Compose, including its language support and system requirements.
The Compose tutorials and associated example model files help introduce you to the basic functionality of the software.
Learn about the features and functionality available in Compose.
Reference guides are available for functions and commands supported by OML, Tcl, and Python.
OpenMatrix is a mathematical scripting language.
The Reference Guide contains documentation for all functions supported in the OpenMatrix language.
Logical conjunction, the 'and' operator.
Short circuit boolean and operator.
Subtraction operator.
Addition operator.
Equality comparison operator.
Adds an existing library or a custom library to load the functions contained in it.
Updates the search path for functions by adding the given directories d, ... to the existing path R.
Adds an existing toolbox or a custom toolbox to load the functions contained in it.
Returns a logical that indicates whether all of the corresponding elements of the input are nonzero.
Performs logical conjunction, the 'and' operation, equivalent to the & operator.
Returns the most recently computed result that was not assigned to a variable.
Returns a logical that indicates whether any of the corresponding elements of the input are nonzero.
Returns the argument (angle) of each element of z in radians. The arguement is defined as atan2(imag(z),real(z)).
Sets an error if the given condition, s, is not satisfied. An optional input argument, errormessage may be used to customize the error displayed when assert fails.
Assigns the value val to variable name var in context con.
Ends execution of the nearest enclosing loop, even if the end condition for the loop has not been satisfied. break will not end execution of multiple, nested loops.
Calls the built-in function f with given inputs, if applicable. If there is a custom function that overrides f, the custom function implementation will be ignored and the built-in function will be executed.
case is used in switch statements and specifies a constant expression, expression, that the variable used in switch is compared with. The expression in each case label must be a constant and unique in the scope of the switch statement.
catch is used in try-catch blocks and is executed when an exception or error occurs in the try block.
Retrieves the class type of the given input, x.
Begins a class definition.
Clears the OML Command Window and moves the cursor to the top left position of the Command Window.
Obliterates variable(s) from memory in the current session of the application.
Erases collected profile data.
Delete all or specified variable(s) from memory in the current session of the application. When no variable names are specified, delete all variables. When -except is specified, exclude the specified variable names from deletion.
Returns the Compose installation root directory path.
Skips statements after continue and executes the next iteration of the loop.
Prints the value of x to the application's Command window.
Prints the name and value of variable x.
Element-wise matrix multiplication operator.
else is used in if-else statements and is executed when the if condition is not satisfied.
Other statement in an if-else expression if no previous 'if' condition are met.
Returns the last index of the collection being indexed.
Equality comparison, equivalent to the == operator.
Displays a custom error message and ends execution.
Displays the error string s without any error stack information and ends the execution.
Evaluates the given expression.
Same as eval except variable or expression is evaluated in context. Context is either 'caller' or 'base'.
Returns an integer (R) based on whether a variable, function, directory, or file with the name s exists in the current session.
Terminates the current session of the application.
Returns false value(s).
Evaluates the specified function with the given input(s).
Returns the largest integer that can be represented by the string x.
For loop is useful for executing many iterations of a statement.
Sets the format for displaying numbers.
Returns the number of registered built-in functions in the application.
Displays the names of the registered built-in functions in the application.
Used to define user-defined functions.
Perform greater than or equal comparison, equivalent to the >= operator.
Generates unique names which can be used for variables, based on the given input(s), s.
Gets the number of command line arguments, argc, that the application is launched with.
Gets the command line argument at the given index, index.
Gets the command line argument at position n supplied as part of the -input option while launching the application.
Gets the value of the environment variable x, defined for the current session of the application.
Gets the number of command line arguments as part of the -input option while launching the application.
Returns collected profile data.
Declares a list of variables as global. When a variable is declared as global it may be accessed within a function without being passed as a parameter. Variables must be declared as global in both the scope they are defined and the scope they are used.
Greater than comparison operator.
Greater than or equal to comparison operator.
Greater than comparison, equivalent to the > operator.
Shows help for the command name or built-in function func.
Returns the horizontal concatenation of x1,x2,...,xN along the 2nd dimension.
Logical decision-making if statement. Can be combined with 'and' 'or' operators to create complex logical tables.
Returns infinite value(s).
Displays a message, prompt, and interrupts script execution until you provide input.
Indicate the variable name of the n-th argument passed into a function.
Returns result R if the input, v, belongs to the class, class.
Returns true if the application is running in batch mode.
Returns true if input is a scalar, complex, or matrix.
Tests if a value is infinite.
Tests if a value is a matrix.
Tests if a value is not a number.
Tests if a value is numeric.
Tests if a value is a scalar.
Tests if a string is a valid variable name.
Enters the keyboard mode, which interrupts the current script and evaluation of the interactive user input(s). To exit 'keyboard' mode: stop the script execution in the user interface, press the Esc key, or type 'return' or 'dbcont'.
Get or set the last error message.
Displays or sets the last warning message.
Perform element-wise matrix left division, equivalent to the .\ operator.
Less than or equal to comparison, equivalent to the <= operator..
Left division of scalars and/or matrices operator.
Element-wise left matrix division operator.
Less than comparison operator.
Less than or equal to comparison operator.
Create a row vector with equally spaced elements.
Create a row vector with logarithmically spaced elements.
Less than comparison, equivalent to the < operator
Returns general data about memory used by the application process.
Construct a grid of points from coordinate vectors.
Begins a methods block within a class definition.
Perform subtraction.
Returns true if the named function f is locked.
Perform left division of scalars and/or matrices, equivalent to the \ operator.
Locks the function into memory meaning it cannot be cleared.
Perform a matrix power operation, equivalent to the ^ operator.
Matrix power operator.
Perform right division of scalars and/or matrices, equivalent to the / operator.
Perform matrix multiplication on a list of arguments from left to right, equivalent to the * operator.
Multiplication operator.
Unlocks the named function f. If no input is given then munlock unlocks the current function.
Abbreviation for Not A Number. If used as a built-in function returns an n x n or m x n matrix where each cell equals NaN.
Returns the number of arguments required by a function, or the number of arguments received by a function, as detailed below.
Check for correct number of inputs.
Returns the number of outputs.
Check for correct number of outputs.
Construct a grid of points from coordinate vectors.
Perform inequality comparison, equivalent to the != operator.
Normalize vectors.
Performs logical negation, the 'not' operation.
Logical negation, the 'not' operator.
Operator for inequality comparison.
Sets the pagination mode for the display of matrices, cell arrays, structs, and strings in sequence so it is easily readable.
Performs logical disjunction, the 'or' operation, equivalent to the | operator.
Logical disjunction, the 'or' operator.
Save in a file an addpath function call for each path defined when the savepath command is executed. These paths can be restored in a future session by executing the saved file.
Indicate the number of threads desired in parallel loops
Sets or displays the current search path for the application.
Interrupts execution of a script or code.
Declares a list of variables as persistent. When a variable is declared as persistent, its value is retained after the function exits.
Perform addition on a list of arguments from left to right.
Returns the coefficients of the derivative of the polynomial whose coefficients are given by the vector x.
Perform power operation, applied to matrices on an element-wise basis, equivalent to the .^ operator.
Element-wise matrix power operator.
Enable/disable internal code profiling.
Begins a properties block within a class definition.
Assigns the value of the environment variable x to value for the current session of the application.
Terminates the current session of the application.
Range operator.
Perform element-wise matrix right division, equivalent to the ./ operator.
Extension of addpath to register a path used by a certain library created with the Library Manager. Call to the function It registers the library's function list.
Clears any function definitions in memory so that the definitions are reread from the corresponding file.
Removes a previously loaded OML library or a custom library.
Resets the current search path for functions to what it was at application startup.
Returns control to OML interpreter.
Element-wise right matrix division operator.
Right division of scalars and/or matrices operator.
Updates the search path for functions by removing the given directories d, ... from the existing path R.
Executes the script s in the current session of the application. The script s either needs to contain the fully qualified path or must reside in the search paths for the current session of the application.
Assigns the value of the environment variable x to value for the current session of the application.
Short circuit boolean 'or' operator.
Skips formatting output when displaying matrices of size greater than or equal to size, resulting in faster printing for large data sets as all elements are printed as floats.
Sorts elements of x into ascending order by default.
Extract a subset of a collection given an indexing method and range. sub on the value val.
Just like an if-else statement but can only compare one variable. Each possibility is represented with a 'case' with the default case being 'otherwise'.
Perform multiplication on a list of arguments from left to right, applied to matrices on an element-wise basis. Equivalent to the .* operator.
Returns true value(s).
try is used in try-catch blocks and is the code that is executed first in the sequence of the try-catch block. If there is an error in the try block, control is passed to the catch block, where exceptions are handled.
Displays the type of input given.
Unary minus sign.
Unary plus sign.
Specify that a function can take a variable number of arguments.
Specifies that a function can return a variable number of outputs.
Shows a list of variable names recognized by the interpreter.
Sets the verbose level in the current session. If level is greater than 0, additional information is provided when the commands are executed.
Gets the version of the application.
Vertically concatenates a1 through aN along the first dimension.
Prints the given input string, s, as a warning.
Displays the string s as a warning, but without any warning stack information.
Gives a brief description on the origin of a function.
While loop that executes until the condition returns false.
Returns the names of variables defined in the current session of the application.
Displays the names, sizes, memory used in bytes and the class or type of each variable defined in the current session of the application.
You've got questions? We've got answers!
Reference guides are available for functions and commands supported by OML, Tcl, and Python.
The Reference Guide contains documentation for all functions supported in the OpenMatrix language.
Evaluates the given expression.
Evaluates the given expression.
eval(A)
a=2
eval('1+a*3')
R = 7
R = eval('a=2')
disp(a)
R = 2
2
© 2022 Altair Engineering, Inc. All Rights Reserved.
Intellectual Property Rights Notice | Technical Support | Cookie Consent