LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading from a text file

Solved!
Go to solution

I have made a code that reads values from the text file. Now I want to produce a graph that can shows the number of items in the files (X-axis) and the values in the text file (Y-axis).

 

0 Kudos
Message 1 of 21
(4,100 Views)
All that you have to do is convert your string to a numeric array and wire that to a waveform graph or chart. The x axis will automatically display the number of items.
0 Kudos
Message 2 of 21
(4,087 Views)

Hi Ak star,

 

I didn't see your file.

Therefore, I cannot help you much, but I can give some suggestions from the vi you post:

1. When reading text file, you should use read from text file instead of read from binary file. Then, use Frac/Exp String to Numberto change from String to Number, or if your data is tab-delimited, using read from spreadsheet file which will change string to number automatically is also applicable.

2. If you've only one data, you can plot an array of number to waveform graph directly.

3. If you've two data, one for x and another for y, use XY Graph to plot. You can put XY Graph down, and press Ctrl+H. Then, point your cursor to XY Graph icon in block diagram to see how to wire a data to XY Graph.

 

Regards, Kate

0 Kudos
Message 3 of 21
(4,085 Views)
Hi, I converted the string into number by using fract/exp string to number function, however this doesn't put it into a numeric array and that is why i think i get this error.
0 Kudos
Message 4 of 21
(4,043 Views)

Yes, you are correct about the cause of the error.

 

If you want some help, you really need to post an example of the text file or at least show what the results from the file read are.

0 Kudos
Message 5 of 21
(4,034 Views)
hi, here is the text file
0 Kudos
Message 6 of 21
(4,014 Views)
You could simply use the code below. If you want to use the exisiting low level functions, you could look at the block diagram of Read From Spreadsheet file to get an idea.
0 Kudos
Message 7 of 21
(4,010 Views)

Hi, i am not sure if this is right and i am using an index array. Also where do i connect the read from spreadsheet file or do i have to replace the reading from the text file with spreedsheet one.

 

0 Kudos
Message 8 of 21
(3,988 Views)
Check this it might help. Let me know if I can help.
Naqqash
0 Kudos
Message 9 of 21
(3,976 Views)
Just replace what you had with the example I posted and wire up the index array correctly. You want the constant wired to the column input.
0 Kudos
Message 10 of 21
(3,973 Views)