My apologies - I’ve been too busy. I'll update the NEWS entry per your suggestion once we resolve the "%-<org-eval>" comment issue you flagged.
Consider this MATLAB code block and expected results.
#+begin_src matlab :exports both :results output latex
m = [4*pi, 3*pi; 2*pi, pi];
result = latex(sym(m));
disp(result)
#+end_src
#+RESULTS:
#+begin_export latex
\left(\begin{array}{cc} 4\,\pi & 3\,\pi \\ 2\,\pi & \pi \end{array}\right)
#+end_export
If we remove the proposed "%-<org-eval>" handling from ob-octave.el, we get the incorrect result:
#+RESULTS:
#+begin_export latex
m = [4*pi, 3*pi; 2*pi, pi];
result = latex(sym(m));
disp(result)
\left(\begin{array}{cc} 4\,\pi & 3\,\pi \\ 2\,\pi & \pi \end{array}\right)
#+end_export
In this case, the *MATLAB* buffer contains:
>> m = [4*pi, 3*pi; 2*pi, pi];
result = latex(sym(m));
disp(result)
'org_babel_eoe'
m = [4*pi, 3*pi; 2*pi, pi];
>> result = latex(sym(m));
>> disp(result)
\left(\begin{array}{cc} 4\,\pi & 3\,\pi \\ 2\,\pi & \pi \end{array}\right)
>> 'org_babel_eoe'
ans =
'org_babel_eoe'
>>
I suspect that the issue is that the MATLAB echo's all commands and that there's noting wrong with comint. For example, matlab-shell buffer, *MATLAB*, the current buffer and at the MATLAB promot, ">>",
M-: RET (comint-send-string (get-buffer-process (current-buffer)) "pwd\n") RET
Results in:
#+begin_example
>> pwd
ans =
'/home/ciolfi/tmp'
#+end_example
Therefore, the adding "%-<org-eval>" MATLAB comments to the code being evaluated, then stripping the echo'd lines containing the "%-<org-eval>" is probably the best option.
Thanks
John