# LabVIEW

cancel
Showing results for
Did you mean:

Solved!
Go to solution

## Read a text file and display a xy graph

Hi!

I am using LabVIEW 8.5, and I am trying to read columns from a file and plot with xy graph. I can do it with two channels, but I am having problems when the numbers of channels connected increase (maybe six or ten).

My text file looks like this:

[Where first column x = time, the rest of the columns are channels = y]

8.828        22.604        23.076            [The number of channels connected can change]

9.828        22.604        22.604

10.828      21.658        22.131

11.828      22.131        22.131

12.828      22.131        22.131

13.828      22.604        22.604

14.828      21.658        22.604

15.828      22.131        22.131

16.828      21.658        23.076

17.828      22.604        22.131

18.828      22.131        22.604

I attached a picture of what I already try… Now I am trying a combination of those. If anyone has some advice or suggestion, please let me know.

Sincerely,

Julieta.

Message 1 of 9
(6,353 Views)
Solution
Accepted by topic author Julieta

## Re: Read a text file and display a xy graph

Try the code below.

Message Edited by Dennis Knutson on 02-16-2010 02:18 PM
Message 2 of 9
(6,338 Views)

## Re: Read a text file and display a xy graph

Thanks for the advice!... I just modified what I had a little bit and it is working, maybe is not the optimums solution…

I would like to make the time invisible in the graph… It that possible? I attached a picture of my graph, because my English is not good.  There are two lines near to 22 (two channels connected at that moment), and a line near to 0 which is time (the strong pink one).  I would like to make invisible the strong prink one only.  I try to make invisible, but I fail… I changed colors looking for another solution and I fail again, because it is taking the colors that I choose for the channels.  I can not disable because I need it to make the x axes works with the time that I already saved.  If someone has an advice or suggestion I really appreciate it…

Sincerely,

Julieta.

Message 3 of 9
(6,244 Views)

## Read a text file and display a xy graph

Hi

Would you be able to post this VI?

I have something simliar to graph, the txt file has commas separating the x-y data

The txt file is of the format

+1.8803E+03, 2.8803E+3

+3.8803E+03, 3.8803E+3

+4.8803E+03, 4.8803E+3

(I've included the first 3 data points there is 100 data points to graph)

I can manipulate the vi to accomodate what I'm doing

Thanks

Message 4 of 9
(5,801 Views)

## Re: Read a text file and display a xy graph

The VI is posted. It's a snippet.

Message 5 of 9
(5,790 Views)

## Re: Read a text file and display a xy graph

Didn't no that.Cheers for the reply.

Message 6 of 9
(5,785 Views)

## Re: Read a text file and display a xy graph

Hi

Excuse my grammar in last reply.That should be, I didn't know that about the snippets.Thank you again for the reply.

I do have an issue plotting my data and correcting the vi posted to suit my data

The data I have is stored in the format x,y,z as per line of the txt file, I need to plot column x against column y while ignoring z in the text file.

+1.8803E+03,+6.8327E+01,+1.4779E+02,0
+5.0000E+03,+7.5986E+01,+1.1293E+02,0
+4.0000E+03,+7.5986E+01,+1.1293E+02,0
+1.0000E+02,+5.8782E+01,-1.7695E+02,0

Thank you

Message 7 of 9
(5,774 Views)

## Re: Read a text file and display a xy graph

In the Index Array function, wire the 0 into the Columns index, rather than the rows index.  (Likewise for the 1, but the 1 actually doesn't need to be wired at all since it is assumed to be the next column in sequence if you leave the input unwired.)

Message 8 of 9
(5,766 Views)

## Re: Read a text file and display a xy graph

Thank you for pointing out the error.

It works perfectly now.

Message 9 of 9
(5,756 Views)