LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Export Text Data to LabVIEW Waveform Chart

Hi all,
 
I have some data written to a text file through a third party software ( I think this doesnt matter) and my requirement is to export the data available in this text data to plot a Chart/Graph in LabVIEW. Is it possible to compare the datas that are taken from two different text files.
 
The text file data is as shown below:
Format no 1
"","NO","Value","Unit"
20061102
20:08:44
,NO. 0, 0.003,mm
,NO. 1, 0.002,mm
,NO. 2, 0.003,mm
,NO. 3, 0.002,mm
,NO. 4, 0.003,mm
,NO. 5, 0.002,mm
20061102
20:09:20
Format no 2
"","Average","Error","X","Y","Ovality"
"","mm","mm","mm","mm","mm"
20061102
20:04:56
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
,25.000 ,0.000,25.001,24.999,0.002
20061102
20:07:15
 

 
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 1 of 9
(4,031 Views)

Yes it is possible and you have to do following

1. Read the text file as spreadsheet string in LabVIEW, using 'file read' functions

2. Convert the spreadsheet string to an array of strings using 'array to spreadsheet function', selecting the suitable delimiter

3. From the array of strings, extract out the data of your interest, using suitable array functions

4. Using string to numeric conversion function, convert this extracted data to an array of suitable numeric representation.

5. Display this array on chart or graph


Is it possible to compare the datas that are taken from two different text files.

To do this, first convert data from both text files as explained.

Now, use 'build array function' to build a 2 D array where each row/ column corresponds to one plot and plot  them on the same graph.

Message 2 of 9
(4,027 Views)
Hi Devchander,
 
I've tried the way you showed but I'm not able to get the proper output. I'll be very thankful to you if you can please send me a simple example VI to demonsrate this.
 
Thankfully,
 
 
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 3 of 9
(4,023 Views)

could you plz attach a sample text file????

Keep it in the same format as given by the third party software that you are using to generate this text file

0 Kudos
Message 4 of 9
(4,021 Views)
The same data is given in the first message itself.
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 5 of 9
(4,019 Views)
it would be a whole lot easier and better for us and you if you could attach an example text file as asked by DEV. Having this file will aid us in getting the results you want.



Joe.
"NOTHING IS EVER EASY"
Message 6 of 9
(3,999 Views)
Sorry
I didnt mean anything to hide
Here I am attaching the sample files
 
Thanks
Using LabVIEW 8.0, 8.0.1, 8.2
Download All
0 Kudos
Message 7 of 9
(3,993 Views)
I've one more requirement ie, how can I merge two or more file ( in the same format ) into a single data array.
I'm looking for such a method in LabVIEW which can be used for any number of files that may go upto 100's or 1000's.
 
Please help me out with a demo VI.
Using LabVIEW 8.0, 8.0.1, 8.2
0 Kudos
Message 8 of 9
(3,976 Views)
Sujit,

You can append several 2D arrays into a larger 2D array using the build array function.  The build array function has two modes.  The default mode will turn several 2D arrays into a single 3D array.  The alternate mode is the "Concatenate Inputs" mode.  This second mode will append the arrays and maintain 2 dimensions. 

If you are expecting 100's or 1000's of arrays, you can perform this task within a loop.  One caveat of using the build array function in a loop is that the build array function is forced to dynamically reallocate memory as the array size increases.  This can result in a large portion of additional memory being consumed.  The better way to program (if you know the size of the final array) would be to initialize an array of sufficient size, and then programatically replace subsections of the array with the data in the text files.

I am attaching a simple VI that opens an array of spreadsheet files, reads them, and appends their contents into a single 2D array.  This VI does not do everything that you need.  You will still need to implement some sort of logic to throw away sections of the array that contain the time stamp and units data.

Hope this helps!
Spex
National Instruments

To the pessimist, the glass is half empty; to the optimist, the glass is half full; to the engineer, the glass is twice as big as it needs to be has a 2x safety factor...
Message 9 of 9
(3,924 Views)