From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: org-babel matlab example Date: Sat, 11 Sep 2010 12:23:17 -0400 Message-ID: <87iq2c2qru.fsf@stats.ox.ac.uk> References: <20100911.101806.1287597470496846955.etimecowboy@gmail.com> <87iq2c2t9t.fsf@stats.ox.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from [140.186.70.92] (port=55357 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuSrK-0001bs-VX for emacs-orgmode@gnu.org; Sat, 11 Sep 2010 12:23:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuSrJ-0004qt-MD for emacs-orgmode@gnu.org; Sat, 11 Sep 2010 12:23:22 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:59986) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuSrJ-0004qf-Ap for emacs-orgmode@gnu.org; Sat, 11 Sep 2010 12:23:21 -0400 In-Reply-To: <87iq2c2t9t.fsf@stats.ox.ac.uk> (Dan Davison's message of "Sat, 11 Sep 2010 11:29:18 -0400") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: etimecowboy Cc: emacs-orgmode@gnu.org Dan Davison writes: > etimecowboy writes: > >> Hi everybody, >> >> I am learning to use org-babel to evaluate in-line Matlab code block, >> but I cannot make it works when I press the "C-c C-c", nor "C-c C-v >> e". > > What happens when you try C-c C-c or C-c C-v e ? There is an issue with > matlab and octave: they return the value of the last /unassigned/ > computation A better way to say this is: they return the value of the special variable "ans". So whatever you do, at the end of the block you need to ensure that "ans" has the value that you want returned. I've updated the Worg page on Matlab and Octave: http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-octave-matlab.php Dan >, so simply ending the code block with a variable name "x" is > not enough. Could you try one of the following schemes please, and let > us know if that solves it: > > #+begin_src matlab :exports results > n = [1:10]; > x = 5*n+4; > ans = x > #+end_src > > #+begin_src matlab :exports results > n = [1:10]; > x = 5*n+4; > x + 0 > #+end_src > > >> The export of code works, but the results was not there. My in-line code is like this: > > There was a little typo in your original block: the keyword is > ":exports" with an s. > > Dan > >> >> #+begin_src matlab :export results >> n = [1:10]; >> x = 5*n+4; >> x >> #+end_src >> >> Is there someone can provide me a working example? Thanks a lot. >> >> >> ----------------------------- >> >> etimecowboy@gmail.com >> >> _.,----,._ >> .:' `:. >> .' `. >> .' `. >> : : >> ` .'`':'`'`/ ' >> `. \ | / ,' >> \ \ | / / >> `\_..,,.._/' >> {`'-,_`'-} >> {`'-,_`'-} >> {`'-,_`'-} >> `YXXXXY' >> ~^^~ >> >> _______________________________________________ >> Emacs-orgmode mailing list >> Please use `Reply All' to send replies to the list. >> Emacs-orgmode@gnu.org >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode