>>> "Eric" == Eric Ludlam <eric.lud...@mathworks.com> writes:
> It looks like an echoing feature is turned on, where input into ML is > echo'd back out again. There's a variable for describing what ML does > since the echo depends on platform or some-such. I think it's been 't' > for a long time. Hm thanks I checked and set (setq matlab-shell-echoes nil) It does not change #+begin_src matlab :results output latex :exports results :eval never-export f=@(t,y)[-t*y^2]; [t,y]=ode45(f,[0 1],1); t=[t(1),t(end)]; y=[y(1),y(end)]; disp('\begin{align*}') fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) disp('\end{align*}') #+end_src Results in #+RESULTS: #+BEGIN_EXPORT latex >> f=@(t,y)[-t*y^2]; >> [t,y]=ode45(f,[0 1],1); >> t=[t(1),t(end)]; >> y=[y(1),y(end)]; >> disp('\begin{align*}') \begin{align*} >> fprintf('t = [%g \\qquad %g \\quad %g] \\\\\n', t) t = [0 \qquad 1 \quad >> fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) y = [1 \qquad 0.666667 \qquad >> disp('\end{align*}') \end{align*} #+END_EXPORT However I wrote a trivial cleaning function which just deletes the lines starting with >> and I obtain the following #+RESULTS: #+BEGIN_EXPORT latex \begin{align*} t = [0 \qquad 1 \quad >> fprintf('y = [%g \\qquad %g \\qquad %g] \n', y) y = [1 \qquad 0.666667 \qquad >> disp('\end{align*}') \end{align*} #+END_EXPORT Which is precisely what I want. I am not able to combine the cleaning function with the new org-babel-execute:matlab-shell Function because (matlab-shell-collect-command-output code))) Returns >> y=[0 5]\n>> Etc so everything is in one line (with \n) that results when inserted in newlines of course but running the cleaning function (flush-lines "^>>" nil nil t)) would delete everything For me this solution is ok but if somebody comes up with a better solution, please go ahead, the 2 new functions are (defun org-babel-execute:matlab-shell (body params) (interactive "P") (let* ((current-file (buffer-file-name)) (code (org-element-property :value (org-element-context))) (result-params (cdr (assoc :result-params params)))) (let ((results (matlab-shell-collect-command-output code))) (org-babel-result-cond result-params results)))) (defun clean-org-matlab-region-output () (interactive) (flush-lines "^>>" nil nil t)) But this is anyhow more relevant for org mode users. I brought up the issue on their mailing list as well but there was not much interest. Uwe ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Matlab-emacs-discuss mailing list Matlab-emacs-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matlab-emacs-discuss