emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] babel, matlab export plot to png fails


From: Neil Jerram
Subject: Re: [O] babel, matlab export plot to png fails
Date: Tue, 15 Aug 2017 11:12:40 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 13/08/17 10:33, Uwe Brauer wrote:
Hi

I would like to execute some matlab code in org file (using GNU emacs 26
and the git version of org mode) and save the result of the plot command
in a png file, so I tried

#+begin_src matlab :session :exports both :file testplot.png
t=[0:0.1:1];
y=sin(t);
plot(t,y)
print -dpng  testplot.png
#+end_src

And also
#+begin_src matlab :results output latex :exports results  :file testplot.png
t=[0:0.1:1];
y=sin(t);
plot(t,y)
print -dpng  testplot.png
#+end_src

But the resulting png files are corrupt. I presume also the matlab
commands are included in the png file which is not correct. But I don't
know who to achieve that just the last command is saved in a png file.

I guess the problem is that the Matlab line "print -dpng testplot.png" is correctly writing the plot to testplot.png, as you want, but then org-mode is overwriting that file because of the ":file testplot.png". I would try deleting ":file testplot.png".

The meaning of ":results output" may be a bit language-dependent - I don't know org-mode well enough to be sure about that yet - but in general I would expect it to consist of the standard output of those commands. So, for example, if you type "print -dpng testplot.png" and Matlab responds with "Generated 'testplot.png'", I would expect ":results output" to contain "Generated 'testplot.png'", not the PNG data.

Regards - Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]