2011-11-08 16:19:04 -05:00
|
|
|
#+Title: a collection of examples for ob-octave tests
|
|
|
|
#+OPTIONS: ^:nil
|
|
|
|
|
|
|
|
* Simple tests
|
|
|
|
:PROPERTIES:
|
|
|
|
:ID: 54dcd61d-cf6c-4d7a-b9e5-854953c8a753
|
|
|
|
:END:
|
|
|
|
Number output
|
|
|
|
#+begin_src octave :exports results :results silent
|
|
|
|
ans = 10
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Array output
|
|
|
|
#+begin_src octave :exports results :results silent
|
|
|
|
ans = 1:4'
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
* Input tests
|
|
|
|
:PROPERTIES:
|
|
|
|
:ID: cc2d82bb-2ac0-45be-a0c8-d1463b86a3ba
|
|
|
|
:END:
|
|
|
|
Input an integer variable
|
|
|
|
#+begin_src octave :exports results :results silent :var s=42
|
|
|
|
ans = s
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Input an array
|
|
|
|
#+begin_src octave :exports results :results silent :var s='(1.0 2.0 3.0)
|
|
|
|
ans = s
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Input a matrix
|
|
|
|
#+begin_src octave :exports results :results silent :var s='((1 2) (3 4))
|
|
|
|
ans = s
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Input a string
|
|
|
|
#+begin_src octave :exports results :results silent :var s="test"
|
|
|
|
ans = s(1:2)
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
Input elisp nil
|
|
|
|
#+begin_src octave :exports results :results silent :var s='nil
|
|
|
|
ans = s
|
|
|
|
#+end_src
|
2011-12-16 14:12:39 -05:00
|
|
|
|
|
|
|
|
|
|
|
* Graphical tests
|
|
|
|
#+begin_src octave :results graphics :file chart.png
|
|
|
|
sombrero;
|
|
|
|
#+end_src
|
|
|
|
|
|
|
|
#+begin_src octave :session
|
|
|
|
sombrero;
|
|
|
|
#+end_src
|