Octave Script Action Tutorial: Unterschied zwischen den Versionen

Aus expecco Wiki (Version 2.x)
Zur Navigation springen Zur Suche springen
Zeile 18: Zeile 18:
<br>[[Datei:Menu delete octave pins.png|300px]]
<br>[[Datei:Menu delete octave pins.png|300px]]


We now have an acton with no inputs and no output.
We now have an acton with no input- and no output pins.


Next, modify the code (Matlab syntax). The default was generated as an example and for quick go/nogo smoke test.
Next, modify the code (Matlab syntax). The default was generated as an example and for quick go/nogo smoke test.

Version vom 7. September 2021, 14:34 Uhr

Introduction[Bearbeiten]

GNU Octave is a language interpreter with a Matlab compatible interface (well, almost. Not the full Matlab functionality is available, but a reasonable subset).

Example Session1: Display a Graph of a Function[Bearbeiten]

As a first simple example, we'll create an action which displays a simple sin-graph in a separate view. Obviously, you will eventually want to display your own data (measurement data vectors), but we start simple here.

Click on "New Octave Action" in the project's tree menu:
Menu new octave action.png

The new created action will have a number of automatically created input and output pins, which we will not need in this example (these pins and their functions will be described later). So those should first be deleted:

  • go to the new action's "Schema Tab",
  • select the pins (either via a lasso, or by shift-clicking on the pins),
  • then right-click for the context menu,
  • select "Remove Pins"


Menu delete octave pins.png

We now have an acton with no input- and no output pins.

Next, modify the code (Matlab syntax). The default was generated as an example and for quick go/nogo smoke test.
Octave code edit1.png

We won't go into details of the code here; it sets up x and y and plots them, followed by setting the graph's title and axis labels. Finally, there is an additional "uiwait" call, which forces the graph-window to remain open until the user closes it manually. Without this, the window would immediately disappear when the action finishes (i.e. when the script reaches the end).

Alternatively to "uiwait", you can also use "pause(N)", to leave the graph window open for N seconds.

Finally, run it, by pressing the green "execute"-button. If all goes well (i.e. you have correctly installed and configured octave), the graph window should appear:
Octave sine graph.png
The action remains in the "executing" state, until the graph window is closed.

See Also[Bearbeiten]



Copyright © 2014-2024 eXept Software AG