1,847
edits
(Use URL without version.) |
|||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= uicontrols: Build a GUI in GNU Octave = | == uicontrols: Build a GUI in GNU Octave == | ||
You have to use the "qt" graphics toolkit (default since 4.0). For the best results GNU Octave version >= 4.2.x should be used. | You have to use the "qt" graphics toolkit (default since 4.0). For the best results GNU Octave version >= 4.2.x should be used. | ||
== | === Example 1: imageViewer === | ||
GUI which opens a file selection dialog when a button is pressed and views the selected image. | GUI which opens a file selection dialog when a button is pressed and views the selected image. | ||
Line 15: | Line 9: | ||
[[File:imageViewer1.png]] [[File:imageViewer2.png]] | [[File:imageViewer1.png]] [[File:imageViewer2.png]] | ||
{{Code|imageViewer example|< | {{Code|imageViewer example|<syntaxhighlight lang="octave"> | ||
%% In file 'imageViewer.m' | %% In file 'imageViewer.m' | ||
function imageViewer () | function imageViewer () | ||
Line 54: | Line 48: | ||
axis image off | axis image off | ||
end | end | ||
</ | </syntaxhighlight>}} | ||
Then run <code>imageViewer()</code> from your terminal: | Then run <code>imageViewer()</code> from your terminal: | ||
=== demo_uicontrol === | === Example 2: demo_uicontrol === | ||
This example tries to show all available uicontrols (needs Octave >= 4.0 and qt): | This example tries to show all available uicontrols (needs Octave >= 4.0 and qt): | ||
Line 64: | Line 58: | ||
[[File:demo_uicontrol1.png]] | [[File:demo_uicontrol1.png]] | ||
{{Code|demo_uicontrol.m|< | {{Code|demo_uicontrol.m|<syntaxhighlight lang="octave"> | ||
## 20.03.2017 Andreas Weber <andy@josoansi.de> | ## 20.03.2017 Andreas Weber <andy@josoansi.de> | ||
## Demo which has the aim to show all available GUI elements. | ## Demo which has the aim to show all available GUI elements. | ||
Line 254: | Line 248: | ||
guidata (gcf, h) | guidata (gcf, h) | ||
update_plot (gcf, true); | update_plot (gcf, true); | ||
</ | </syntaxhighlight>}} | ||
== See also == | |||
* [https://octave.org/doc/interpreter/GUI-Development.html GNU Octave manual -- GUI Development] | |||
[[Category:Examples]] |