emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [Orgmode] Re: org-babel matlab example


From: Darlan Cavalcante Moreira
Subject: Re: [Orgmode] Re: org-babel matlab example
Date: Sun, 12 Sep 2010 11:58:28 -0300
User-agent: Wanderlust/2.15.6 (Almost Unreal) Emacs/23.1 Mule/6.0 (HANACHIRUSATO)

Can I leave a suggestion here?
Maybe a header argument
,----
| :return variableName
`----
could be interesting in org babel. This would make babel behavior more
uniform in all supported languages and avoid the necessity of adding code
"only to make babel work".

--
Darlan

At Sun, 12 Sep 2010 08:45:40 +0100 (BST),
etimecowboy <address@hidden> wrote:
> 
> From: Dan Davison <address@hidden>
> Subject: Re: org-babel matlab example
> Date: Sat, 11 Sep 2010 12:23:17 -0400
> 
> > Dan Davison <address@hidden> writes:
> > 
> >> etimecowboy <address@hidden> 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.
> >>>
> >>>
> >>> -----------------------------
> >>>
> >>> address@hidden
> >>>
> >>>       _.,----,._
> >>>     .:'        `:.
> >>>   .'              `.
> >>>  .'                `.
> >>>  :                  :
> >>>  `    .'`':'`'`/    '
> >>>   `.   \  |   /   ,'
> >>>     \   \ |  /   /
> >>>      `\_..,,.._/'
> >>>       {`'-,_`'-}
> >>>       {`'-,_`'-}
> >>>       {`'-,_`'-}
> >>>        `YXXXXY'
> >>>          ~^^~
> >>>
> >>> _______________________________________________
> >>> Emacs-orgmode mailing list
> >>> Please use `Reply All' to send replies to the list.
> >>> address@hidden
> >>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> >>
> >> _______________________________________________
> >> Emacs-orgmode mailing list
> >> Please use `Reply All' to send replies to the list.
> >> address@hidden
> >> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
> 
> Dear Dan,
> 
> I have checked the Worg page you updated and tried your example. It works! 
> The ans variable is the secret! Thanks a lot. I suggest org should provide 
> some examples in its user's guide, not only on the topic of Babel but also 
> Table, Hyperlink, Picture, and etc.
> 
> -----------------------------
> 
> address@hidden
> 
>       _.,----,._
>     .:'        `:.
>   .'              `.
>  .'                `.
>  :                  :
>  `    .'`':'`'`/    '
>   `.   \  |   /   ,'
>     \   \ |  /   /
>      `\_..,,.._/'
>       {`'-,_`'-}
>       {`'-,_`'-}
>       {`'-,_`'-}
>        `YXXXXY'
>          ~^^~
> 
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

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