Re: Help-octave Digest, Vol 42, Issue 28

View: New views
6 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: Help-octave Digest, Vol 42, Issue 28

by johny gaddar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello

i am new user to octave

i have a c program whose output which is two colums of data should be plotted by octave as X and Y
i am using red hat machine.

any suggestions are appreciated.

regards
Johny


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Help-octave Digest, Vol 42, Issue 28

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Sonntag, 13. September 2009 12:59:30 schrieb johny gaddar:

> Hello
>
> i am new user to octave
>
> i have a c program whose output which is two colums of data should be
> plotted by octave as X and Y
> i am using red hat machine.
>
> any suggestions are appreciated.
>
> regards
> Johny

Dear Johny,

from your description I asume that your program creates some file which you
want to read in octave to plot it (is that correct).
Can you provide a simple example of such file to see the format of the numbers
how they are delimited and if the file contains some header?
Then I can give you a hint how to read and display it.

In general you can for example look at csvread and similar functions

help csvread
`csvread' is a function from the file /usr/share/octave/3.2.0/m/io/csvread.m

 -- Function File: X = csvread (FILENAME)
     Read the matrix X from a file.

     This function is equivalent to
          dlmread (FILENAME, "," , ...)

     See also: dlmread, dlmwrite, csvwrite

- mh
_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Parent Message unknown RE: Help-octave Digest, Vol 42, Issue 28

by dastew :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
In octave do

pwd

(present working directory  pwd)

this is where octave will look for the file, so copy the data file to there and then octave will find it.

Doug




Date: Sun, 13 Sep 2009 16:59:33 +0530
Subject: Re: Help-octave Digest, Vol 42, Issue 28
From: johny1888@...
To: dastew@...

thanks.

i am saving the output data of c program in data file named data.dat
now to load the file into octave, octave will need to know where the file is.
how i should tell octave where to find it
i saw the help on load, but it is not giving this info.

regards,
Johny

On Sun, Sep 13, 2009 at 4:39 PM, <dastew@...> wrote:
One way to do it is to write the data to a text file, and then use the load command in octave to read the data from the file, and then plot it in octave.

Doug


Date: Sun, 13 Sep 2009 16:29:30 +0530
Subject: Re: Help-octave Digest, Vol 42, Issue 28
From: johny1888@...
Hello

i am new user to octave

i have a c program whose output which is two colums of data should be plotted by octave as X and Y
i am using red hat machine.

any suggestions are appreciated.

regards
Johny



_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

RE: Help-octave Digest, Vol 42, Issue 28

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


dastew wrote:
In octave do

pwd

(present working directory  pwd)

this is where octave will look for the file, so copy the data file to there and then octave will find it.

Doug



Date: Sun, 13 Sep 2009 16:59:33 +0530
Subject: Re: Help-octave Digest, Vol 42, Issue 28
From: johny1888@gmail.com
To: dastew@sympatico.ca

thanks.

i am saving the output data of c program in data file named data.dat
now to load the file into octave, octave will need to know where the file is.
how i should tell octave where to find it
i saw the help on load, but it is not giving this info.


regards,
Johny

On Sun, Sep 13, 2009 at 4:39 PM,  <dastew@sympatico.ca> wrote:






One way to do it is to write the data to a text file, and then use the load command in octave to read the data from the file, and then plot it in octave.

Doug

Date: Sun, 13 Sep 2009 16:29:30 +0530
Subject: Re: Help-octave Digest, Vol 42, Issue 28

From: johny1888@gmail.com
To: help-octave@octave.org


Hello

i am new user to octave

i have a c program whose output which is two colums of data should be plotted by octave as X and Y
i am using red hat machine.

any suggestions are appreciated.


regards

Johny




_______________________________________________
Help-octave mailing list
Help-octave@octave.org
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave
If you do not want to copy the file by hand you can load also tell to use a path
for example

load -ascii "/path/to/datafile/data.dat"
plot(data(1,:), data(2,:))

- mh

Re: Help-octave Digest, Vol 42, Issue 28

by johny gaddar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

yes, i am storing the output of the program in .dat kind of file

the file contents look like this.....


0 1
1 3
4 7
7 8

and so on.
there are only two columns. of integers. thats all.
i want to plot second column against first column in octave.
other than this, file does not contain anything else.

regards,
Johny


On Sun, Sep 13, 2009 at 5:24 PM, Martin Helm <martin@...> wrote:
Am Sonntag, 13. September 2009 12:59:30 schrieb johny gaddar:
> Hello
>
> i am new user to octave
>
> i have a c program whose output which is two colums of data should be
> plotted by octave as X and Y
> i am using red hat machine.
>
> any suggestions are appreciated.
>
> regards
> Johny

Dear Johny,

from your description I asume that your program creates some file which you
want to read in octave to plot it (is that correct).
Can you provide a simple example of such file to see the format of the numbers
how they are delimited and if the file contains some header?
Then I can give you a hint how to read and display it.

In general you can for example look at csvread and similar functions

help csvread
`csvread' is a function from the file /usr/share/octave/3.2.0/m/io/csvread.m

 -- Function File: X = csvread (FILENAME)
    Read the matrix X from a file.

    This function is equivalent to
         dlmread (FILENAME, "," , ...)

    See also: dlmread, dlmwrite, csvwrite

- mh


_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave

Re: Help-octave Digest, Vol 42, Issue 28

by martin_helm :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Am Sonntag, 13. September 2009 17:13:47 schrieb johny gaddar:

> yes, i am storing the output of the program in .dat kind of file
>
> the file contents look like this.....
>
>
> 0 1
> 1 3
> 4 7
> 7 8
>
> and so on.
> there are only two columns. of integers. thats all.
> i want to plot second column against first column in octave.
> other than this, file does not contain anything else.
>
> regards,
> Johny
>

So the form

load -ascii "/path/to/datafile/data.dat"
plot(data(1,:), data(2,:))

should work (assuming data.dat) otherwise the resulting variable has simply a
different name

mymatrix.dat -> mymatrix cointains the data and so on.


> On Sun, Sep 13, 2009 at 5:24 PM, Martin Helm <martin@...> wrote:
> > Am Sonntag, 13. September 2009 12:59:30 schrieb johny gaddar:
> > > Hello
> > >
> > > i am new user to octave
> > >
> > > i have a c program whose output which is two colums of data should be
> > > plotted by octave as X and Y
> > > i am using red hat machine.
> > >
> > > any suggestions are appreciated.
> > >
> > > regards
> > > Johny
> >
> > Dear Johny,
> >
> > from your description I asume that your program creates some file which
> > you want to read in octave to plot it (is that correct).
> > Can you provide a simple example of such file to see the format of the
> > numbers
> > how they are delimited and if the file contains some header?
> > Then I can give you a hint how to read and display it.
> >
> > In general you can for example look at csvread and similar functions
> >
> > help csvread
> > `csvread' is a function from the file
> > /usr/share/octave/3.2.0/m/io/csvread.m
> >
> >  -- Function File: X = csvread (FILENAME)
> >     Read the matrix X from a file.
> >
> >     This function is equivalent to
> >          dlmread (FILENAME, "," , ...)
> >
> >     See also: dlmread, dlmwrite, csvwrite
> >
> > - mh

_______________________________________________
Help-octave mailing list
Help-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave