Prev | Next |
Solver Consoles
The Solver Console is an easily-accessed and simple-to-use editor. It is primarily for managing MATLAB and Octave Solvers, providing simple and quick access to test functions supported in these external applications. The Solver Console can be used for creating, checking and maintaining calls used in simulations, as well as in scripts written using JavaScript.
Access
Ribbon |
Simulate > Console > Solvers > MATLAB Simulate > Console > Solvers > Octave |
Solver Initialization
The chosen Solver is set automatically to one of these:
MATLAB:
- var matlab = new Solver("matlab");
Octave:
- var octave = new Solver("octave");
If the background Octave or MATLAB is accessible, the Console will prompt with the starting detail and be ready to accept any input.
Usage
The Console accepts single line JavaScript commands that will be executed one at a time. Enter new commands in the bottom text-entry section and press the
to execute the command.The executed command will be added to the main output panel, with any output from the command.
The Solvers can then be accessed using the Solver Class functions; for example:
MATLAB:
- matlab.set('<variable_name>', <value>)
- matlab.get('<variable_name>')
- matlab.exec(<function>, <parameters>)
Octave:
- octave.set('<variable_name>', <value>)
- octave.get('<variable_name>')
- octave.exec(<function>, <parameters>)
For more details see the Octave Solver and the MATLAB Solver Help topics.
Previous commands that have been entered can be re-used by pressing the
key or Down Arrow key.Output
To output the value of a variable or a function you can use:
- ? <variable_name>
- ? <function>
Example
This illustration shows some examples of using the Octave Solver's Set, Get and Exec, as well as the output using ?, in the Octave Console:
The Octave plot is the generated output of the two ocatave.exec() statements.
Console Commands
Console commands are preceded by the ! character and instruct the Console to perform an action. The Console commands include:
- !clear - clears the Console display
- !save - saves the Console display to a file
- !help - prints a list of commands
- !close - closes the Console
- !include <scriptname> - executes the named script item; scriptname is of the format GroupName.ScriptName (spaces are allowed in names)
- ? - lists commands (same as !help)
- ? <variable or function> - outputs the value