emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* problem with ob-octave (matlab)
@ 2016-03-31 17:44 Uwe Brauer
  2016-03-31 17:58 ` John Kitchin
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2016-03-31 17:44 UTC (permalink / raw)
  To: emacs-orgmode

Hello

I can successfully execute


#+BEGIN_SRC matlab
A=[3 4; 5 6]
b=[5;6]
A\b
#+END_SRC

#+RESULTS:
|  -3 |
| 3.5 |

However 
#+BEGIN_SRC matlab
syms a b
A=[a,b;b,a]
eig(A) 
#+END_SRC


Does not work

I obtain

executing Matlab code block...
Wrote /tmp/babel-2948rpV/ob-input-2948ACJ
Error reading results: (beginning-of-buffer)
Code block produced no output.


However the code can be executed in matlab giving


ans =
 
 a + b
 a - b


Any comments?

Thanks

Uwe Brauer 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-03-31 17:44 problem with ob-octave (matlab) Uwe Brauer
@ 2016-03-31 17:58 ` John Kitchin
  2016-04-01  8:30   ` Uwe Brauer
  0 siblings, 1 reply; 8+ messages in thread
From: John Kitchin @ 2016-03-31 17:58 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode

sometimes setting :results to raw or code can help.

I occasionally have trouble when the results get interpreted as cons
cells, and maybe some other things too (in other languages but i think
it a general problem.)

Uwe Brauer writes:

> Hello
>
> I can successfully execute
>
>
> #+BEGIN_SRC matlab
> A=[3 4; 5 6]
> b=[5;6]
> A\b
> #+END_SRC
>
> #+RESULTS:
> |  -3 |
> | 3.5 |
>
> However
> #+BEGIN_SRC matlab
> syms a b
> A=[a,b;b,a]
> eig(A)
> #+END_SRC
>
>
> Does not work
>
> I obtain
>
> executing Matlab code block...
> Wrote /tmp/babel-2948rpV/ob-input-2948ACJ
> Error reading results: (beginning-of-buffer)
> Code block produced no output.
>
>
> However the code can be executed in matlab giving
>
>
> ans =
>
>  a + b
>  a - b
>
>
> Any comments?
>
> Thanks
>
> Uwe Brauer


--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-03-31 17:58 ` John Kitchin
@ 2016-04-01  8:30   ` Uwe Brauer
  2016-04-01 11:09     ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2016-04-01  8:30 UTC (permalink / raw)
  To: John Kitchin; +Cc: Uwe Brauer, emacs-orgmode

>>> "John" == John Kitchin <jkitchin@andrew.cmu.edu> writes:

   > sometimes setting :results to raw or code can help.
   > I occasionally have trouble when the results get interpreted as cons
   > cells, and maybe some other things too (in other languages but i think
   > it a general problem.)

You mean

#+BEGIN_SRC matlab
syms a b
A=[a,b;b,a]
eig(A) 
#+END_SRC

#+RESULTS: code

This did not help. Did you get that code snippet to work?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-04-01  8:30   ` Uwe Brauer
@ 2016-04-01 11:09     ` Eric S Fraga
  2016-04-01 12:29       ` Uwe Brauer
  0 siblings, 1 reply; 8+ messages in thread
From: Eric S Fraga @ 2016-04-01 11:09 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, John Kitchin

On Friday,  1 Apr 2016 at 08:30, Uwe Brauer wrote:
> You mean
>
> #+BEGIN_SRC matlab
> syms a b
> A=[a,b;b,a]
> eig(A) 
> #+END_SRC
>
> #+RESULTS: code

No, I think John meant:

#+BEGIN_SRC matlab :results code
syms a b
A=[a,b;b,a]
eig(A) 
#+END_SRC

i.e. a header argument for the src block.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.92.1, Org release_8.3.4-668-g809a83

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-04-01 11:09     ` Eric S Fraga
@ 2016-04-01 12:29       ` Uwe Brauer
  2016-04-01 15:49         ` Eric S Fraga
  0 siblings, 1 reply; 8+ messages in thread
From: Uwe Brauer @ 2016-04-01 12:29 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, John Kitchin

>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

   > On Friday,  1 Apr 2016 at 08:30, Uwe Brauer wrote:
   >> You mean
   >> 
   >> #+BEGIN_SRC matlab
   >> syms a b
   >> A=[a,b;b,a]
   >> eig(A) 
   >> #+END_SRC
   >> 
   >> #+RESULTS: code

   > No, I think John meant:

   > #+BEGIN_SRC matlab :results code
   > syms a b
   > A=[a,b;b,a]
   > eig(A) 
   > #+END_SRC


I see, I tried


#+BEGIN_SRC matlab :results code
syms a b
A=[a,b;b,a]
eig(A) 
#+END_SRC


#+BEGIN_SRC matlab :results raw
syms a b
A=[a,b;b,a]
eig(A) 
#+END_SRC

#+RESULTS:

None of them worked.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-04-01 12:29       ` Uwe Brauer
@ 2016-04-01 15:49         ` Eric S Fraga
  2016-04-01 16:18           ` Eric S Fraga
  2016-04-01 17:06           ` Uwe Brauer
  0 siblings, 2 replies; 8+ messages in thread
From: Eric S Fraga @ 2016-04-01 15:49 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, John Kitchin

I don't have MATLAB on the system I'm on at the moment but trying your
(slightly modified) example with octave instead works:

#+begin_src org
  ,#+BEGIN_SRC octave :results output
    pkg load symbolic
    syms a b
    A=[a,b;b,a]
    eig(A) 
  ,#+END_SRC

  ,#+results:
  ,#+begin_example
  OctSymPy v2.2.4: this is free software without warranty, see source.
  Initializing communication with SymPy using a popen2() pipe.
  Some output from the Python subprocess (pid 28058) might appear next.

  OctSymPy: Communication established.  SymPy v0.7.6.1.
  A = (sym 2×2 matrix)

    ⎡a  b⎤
    ⎢    ⎥
    ⎣b  a⎦

  ans = (sym 2×1 matrix)

    ⎡       ____⎤
    ⎢      ╱  2 ⎥
    ⎢a - ╲╱  b  ⎥
    ⎢           ⎥
    ⎢       ____⎥
    ⎢      ╱  2 ⎥
    ⎣a + ╲╱  b  ⎦


  ,#+end_example

#+end_src 

I don't know if this helps you at all and/or whether the issue is with
MATLAB...

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.92.1, Org release_8.3.4-668-g809a83

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-04-01 15:49         ` Eric S Fraga
@ 2016-04-01 16:18           ` Eric S Fraga
  2016-04-01 17:06           ` Uwe Brauer
  1 sibling, 0 replies; 8+ messages in thread
From: Eric S Fraga @ 2016-04-01 16:18 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, John Kitchin

[-- Attachment #1: Type: text/plain, Size: 177 bytes --]

Ummm, some characters lost in translation...  attached is an image of
the output from octave in org looks like on my system.  Not sure why
gnus got confused with charsets etc.


[-- Attachment #2: screendump-20160401171708.png --]
[-- Type: image/png, Size: 24243 bytes --]

[-- Attachment #3: Type: text/plain, Size: 81 bytes --]


-- 
: Eric S Fraga (0xFFFCF67D), Emacs 25.0.92.1, Org release_8.3.4-668-g809a83

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: problem with ob-octave (matlab)
  2016-04-01 15:49         ` Eric S Fraga
  2016-04-01 16:18           ` Eric S Fraga
@ 2016-04-01 17:06           ` Uwe Brauer
  1 sibling, 0 replies; 8+ messages in thread
From: Uwe Brauer @ 2016-04-01 17:06 UTC (permalink / raw)
  To: Uwe Brauer; +Cc: emacs-orgmode, John Kitchin

>>> "Eric" == Eric S Fraga <e.fraga@ucl.ac.uk> writes:

   > I don't have MATLAB on the system I'm on at the moment but trying your
   > (slightly modified) example with octave instead works:

Aha!

#+BEGIN_SRC matlab :results output
    syms a b
    A=[a,b;b,a]
    eig(A) 
#+END_SRC

This worked as well! Thanks!

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-04-01 17:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-31 17:44 problem with ob-octave (matlab) Uwe Brauer
2016-03-31 17:58 ` John Kitchin
2016-04-01  8:30   ` Uwe Brauer
2016-04-01 11:09     ` Eric S Fraga
2016-04-01 12:29       ` Uwe Brauer
2016-04-01 15:49         ` Eric S Fraga
2016-04-01 16:18           ` Eric S Fraga
2016-04-01 17:06           ` Uwe Brauer

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).