pasting data

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

pasting data

Przemek Klosowski-7
I often use octave for quick calculations.  For instance, I had some
voltage/current data for a sensor, and wanted to see a plot and fit  a
trendline (first and second order polynomials). I started by putting the
data in a spreadsheet, but then I wanted to calculate some derived
quantities and realized that  easier to work with the data in Octave.

The simplest and quickest way to cut data into Octave's commandline is
to just assign it into an array: type 'a=[', then paste the table of
data, and follow by a ']'. This works for most contexts, except when the
column separator is a tab, as is the case when you're copying from a 
spreadsheet. I think tabs trigger readline's completion mechanism and at
best do nothing and at worst could corrupt pasted data.

The tabs are even a problem when constructing a string while trying to
use strread().

I know that I could save the data into a file outside of octave ("cat >
/tmp/data", paste data and type Ctrl-D) and textread() it, but that's
too much work :)

Is there a way to temporarily disable readline's TAB functionality, or
bypass it in some clever way?




Reply | Threaded
Open this post in threaded view
|

Re: pasting data

Ozzy Lash


On Tue, Mar 20, 2018 at 1:00 PM, Przemek Klosowski <[hidden email]> wrote:
I often use octave for quick calculations.  For instance, I had some voltage/current data for a sensor, and wanted to see a plot and fit  a trendline (first and second order polynomials). I started by putting the data in a spreadsheet, but then I wanted to calculate some derived quantities and realized that  easier to work with the data in Octave.

The simplest and quickest way to cut data into Octave's commandline is to just assign it into an array: type 'a=[', then paste the table of data, and follow by a ']'. This works for most contexts, except when the column separator is a tab, as is the case when you're copying from a  spreadsheet. I think tabs trigger readline's completion mechanism and at best do nothing and at worst could corrupt pasted data.

The tabs are even a problem when constructing a string while trying to use strread().

I know that I could save the data into a file outside of octave ("cat > /tmp/data", paste data and type Ctrl-D) and textread() it, but that's too much work :)

Is there a way to temporarily disable readline's TAB functionality, or bypass it in some clever way?



There is probably a better way, but i didn't find a way to directly control the readline bindings, but you could create a file, say "readline_disable_tab" with the contents:

set disable-completion on

and then, in octave do a:

readline_read_init_file("readline_disable_tab")

Bill