Converting Octave vector to Sage list – ASKSAGE: Sage Q&A Forum

  1. Home
  2. vector maps manual
  3. Converting Octave vector to Sage list – ASKSAGE: Sage Q&A Forum

I have a Sage notebook that combines Sage and Octave code. How can I make the output of the Octave code (a vector) available to Sage as a list or vector? Does [the Sage-Octave interface page](http://www.sagemath.org/doc/reference/interfaces/sage/interfaces/octave.html) help? No, it doesn’t. It describes a function for going from a Sage list to an Octave matrix, but I need to go the other way. In general, you should be able to access variables from other programs using the methods in this question. Unfortunately, as vdelecroix points out, Sage’s reverse interface to Octave is too rudimentary. But maybe someone will write a better parser for various Octave objects… and this will work for very simple things like integers. I did not find anything in the documentation. But you can at least parse the ouptut of octave as a string: The function map juste evaluate the function Integer on each element of str(v).split() which is the list [‘1′,’5′,’7’]. The method split of strings is very useful: it splits a string at each space character. Source.

Menu
whatsapp button