#+Title: A collection of examples for ob-matlab tests #+OPTIONS: ^:nil * Test MATLAB results output :PROPERTIES: :ID: 99332277-5e0e-4834-a3ad-ebcaddb855ab :END: #+begin_src matlab :results output disp('The results are:') a = [1, 2; 3, 4] b = a * 2 #+end_src #+RESULTS: #+begin_example The results are: a = 1 2 3 4 b = 2 4 6 8 #+end_example Following validates whitespace is preserved #+begin_src matlab :results output disp(' +---+') disp(' |one|') disp(' +---+') disp(newline) disp([' ', num2str(1)]); disp(newline) disp(' +---+') disp(' |two|') disp(' +---+') disp(newline) disp([' ', num2str(2)]); disp(newline) #+end_src * Test reuse of MATLAB buffer with results output :PROPERTIES: :ID: a68db9ff-efdf-42b9-85fc-174015cd1f77 :END: #+begin_src matlab :results output a = 123 #+end_src #+RESULTS: : a = : : 123 #+begin_src matlab :exports both :results output b = a + 1000 #+end_src #+RESULTS: : b = : : 1123 Following should give: Unrecognized function or variable 'b'. #+begin_src matlab :results output clear c = b * 2 #+end_src #+RESULTS: : Unrecognized function or variable 'b'. * Test results verbatim :PROPERTIES: :ID: 278047b6-4b87-4852-9050-e3e99fcaabb8 :END: #+begin_src matlab :results verbatim a = 2 + 3; ans = magic(a); #+end_src * Test results output latex :PROPERTIES: :ID: 7a8190be-d674-4944-864e-6fdaa7362585 :END: #+begin_src matlab :results output latex m = [4*pi, 3*pi; 2*pi, pi]; result = latex(sym(m)); disp(result) #+end_src * Test results file graphics :PROPERTIES: :ID: 5bee8841-a898-4135-b44b-f1bd5465ceed :END: #+begin_src matlab :results file graphics :file NAME.png t = [0 : 0.1 : 2*pi]; y = sin(t); plot(t, y); set(gcf, 'PaperUnits', 'inches', 'PaperPosition', [0 0 4 3]) % Set the size to 4" x 3" #+end_src # LocalWords: ebcaddb efdf fc fcaabb fdaa ceed sinewave