Is it possible to drag-n-drop data into Octave workspace?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
9 messages Options
Per
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is it possible to drag-n-drop data into Octave workspace?

Per
Excuse my ignorance but this is all very new to me. Octave 4.2.0 running on Windows 8 (64-bit). A colleague of mine did some FFT calculations in Matlab. I have the .m files and they run ok in Octave if I use some of his example data that is in a .mat file. I was peeking over his shoulder when he was highlighting the data in an Excel spread sheet and just copied and pasted it into the Matlab window and the data showed up in the “Workspace” in the right format. I didn’t pay full attention to what he was doing in detail, and honestly can’t remember. Is there any similar way that I can easily import the data I need for my calculation from an open Excel spread sheet into the Octave Workspace? Any drag-and-drop options? The data is in a real simple format. A header line, and two columns of data, a few thousands of rows long. Distance Tension 0 1,928 0,005 1,936 0,01 1,938 0,015 1,944 I have seen some older comments on something similar with the need of installing the io package as well as the windows package. I did run the ‘pkg list’ in the command window and I can see ‘io’ being listed. Do I still need to install /enable it with ‘pkg install -forge -auto io’ ? Or is it already installed/enabled when it shows up in my list? Do I also need ‘pkg install -auto windows-1.2.1.tar.gz’ ? As you can tell I’m pretty lost in this world of install, enable, load etc. When the packages are in place, what code you I need to enter to read my spread sheet data? xlsread? A detailed example would be much appreciated for a lost soul. Please dumb it down and help me into the magic world of Octave.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

Olaf Till-2
On Tue, Feb 21, 2017 at 02:16:10AM -0800, Per wrote:
> I was peeking over his shoulder when he was
> highlighting the data in an Excel spread sheet and just copied and pasted it
> into the Matlab window and the data showed up in the “Workspace” in the
> right format.

What could work is copying a single column of numerical data. If I
'edit/copy' a single column in gnumeric, and start Octave (text modus)
in a gnome terminal, the following is possible:

First, type a [ :

octave:1> [

then, edit/paste from the terminal menu :

octave:1> [1
> 2
> 3
> 4
> 5
> 6

then, type ] and <enter> :

octave:1> [1
> 2
> 3
> 4
> 5
> 6]
ans =

   1
   2
   3
   4
   5
   6


It also works in Octaves graphical interface.

Olaf

--
public key id EAFE0591, e.g. on x-hkp://pool.sks-keyservers.net

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

NJank
> ans =
>
>    1
>    2
>    3
>    4
>    5
>    6

Interesting. I would have thought without the semicolons it would
treat the linebreak as whitespace and make that a row vector. Don't
have it open in front of me, but is that normal behavior for an input
split over multiple lines without using line continuation marks? If
so, what happens if you try to do the same pasting in a 2-column set
of data?

From the original question, could the 'paste' function in the gui
somehow catch, recognize and automatically make the array input
happen?

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

Przemek Klosowski-7
On 02/21/2017 12:27 PM, Nicholas Jankowski wrote:
ans =

   1
   2
   3
   4
   5
   6
Interesting. I would have thought without the semicolons it would
treat the linebreak as whitespace and make that a row vector. Don't
have it open in front of me, but is that normal behavior for an input
split over multiple lines without using line continuation marks? If
so, what happens if you try to do the same pasting in a 2-column set
of data?
It works as-is---whitespace  within rows divides columns, and newlines create new rows.

From the original question, could the 'paste' function in the gui
somehow catch, recognize and automatically make the array input
happen?
This is an annoying glitch: it almost works but ultimately fails with a bizarre behavior, because cutting and pasting from a typical spreadsheet uses tabs between the successive numbers in each row, and tab is processed by the readline code. As a result, most of the time tabs are simply eaten up and all the  numbers on each line are collated, except when the tab triggers a match, inserting random readline history items. 

Of course readline is very useful, even while reading data arrays, so it's not a good solution to turn it off entirely---but maybe there would be a way to suspend it for a single command? I don't think there is a way to do it automatically for cut-and-paste because commandline octave has no way of knowing what's coming its way. Maybe the GUI could tell and adapt.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

Doug Stewart-4
In reply to this post by NJank


On Tue, Feb 21, 2017 at 12:27 PM, Nicholas Jankowski <[hidden email]> wrote:
> ans =
>
>    1
>    2
>    3
>    4
>    5
>    6

Interesting. I would have thought without the semicolons it would
treat the linebreak as whitespace and make that a row vector. Don't
have it open in front of me, but is that normal behavior for an input
split over multiple lines without using line continuation marks? If
so, what happens if you try to do the same pasting in a 2-column set
of data?

From the original question, could the 'paste' function in the gui
somehow catch, recognize and automatically make the array input
happen?

yes

I just tried it. If in your spreadsheet you have a column  of data in
column A and a column of commas in column b and
a column of data in column c

and the in octave do

a=[
and paste the data
1 , 2
4 , 3
5 , 6
8 , 7
 

and add the   ]

it works

Doug  

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

NJank
In reply to this post by Przemek Klosowski-7
On Tue, Feb 21, 2017 at 1:16 PM, Przemek Klosowski
<[hidden email]> wrote:
> On 02/21/2017 12:27 PM, Nicholas Jankowski wrote:
> Maybe the GUI could tell and adapt.

Yes, I was thinking mainly for the GUI where we have control over the
interpreter. I can't imagine any transparent way of having octave tell
that you're pasting in a set of cells instead of typing in characters
for arbitrary CLI shells.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

Przemek Klosowski-7
In reply to this post by Doug Stewart-4
On 02/21/2017 01:24 PM, Doug Stewart wrote:
I just tried it. If in your spreadsheet you have a column  of data in
column A and a column of commas in column b and
a column of data in column c

That's a cool trick but it still is vulnerable to spurious readline completions, I think.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

tmacchant
In reply to this post by Per


----- Original Message -----

> From: Per <[hidden email]>
> To: [hidden email]
> Cc:
> Date: 2017/2/21, Tue 19:16
> Subject: Is it possible to drag-n-drop data into Octave workspace?
>
> I have seen some older comments on something similar with the need
> of installing the io package as well as the windows package.I did run the
> ‘pkg list’ in the command window and I can see ‘io’ being listed. Do I still
> need to install /enable it with ‘pkg install -forge -auto io’ ? Or is it
> already installed/enabled when it shows up in my list?Do I also need ‘pkg
> install  -auto  windows-1.2.1.tar.gz’ ? As you can tell I’m pretty lost in
> this world of install, enable, load etc.When the packages are in place, what
> code you I need to enter to read my spread sheet data? xlsread? A detailed
> example would be much appreciated for a lost soul. Please dumb it down and
> help me into the magic world of Octave.
>


Do I still need to install /enable it with ‘pkg install -forge -auto io’ ? 


NO.

To activate io and windows packages, 

>> pkg load io windows

if you install your octave via installer.

If you install octave from zip archive, execute once

>> pkg rebuild

Tatsuro

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Per
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is it possible to drag-n-drop data into Octave workspace?

Per
Thank you guys for your help. The key for me was the correct activation of the io and windows packages,>> pkg load io windows. Allthough no drag-n-drop I can now fairly easy execute these lines and load the data.
 
Distance=xlsread('A.xlsx','Sheet1','A4:A2103');
Tension=xlsread('A.xlsx','Sheet1','B4:B2103');

Thanks again.
Loading...