LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Read data of a text file then display into 3-array graph

I am able to read data from c:\data.rpt & created 3 separate arrays then display them, however I can not find the way to plot them. Can anyone help?

 

- The first column is for X-axis      (timing is not evently & in second)

 

- The second column is for Y1      (Temperature C)

- The third column is for Y2           (Humidity %)

 

Thank for any help,

0 Kudos
Message 1 of 9
(2,980 Views)

here is a solution

 

 

0 Kudos
Message 2 of 9
(2,973 Views)

The VI you provided is actually in 8.5, not 8.2. Also, it has more code than is necessary:

 

  • Instead of using the string variant of the Read From Spreadsheet File, use the "double" version. This eliminates all of the Fract/Exp String to Number functions.
  • Instead of transposing the 2D array and peeling off rows, just peel of columns directly from the 2D array. 
  • Instead of having 3 separate Index Array functions, use 1 and simply resize it. 
  • Converting an array of DBL to an array of DBL using the To Double Precision Float function is redundant and pointless.

Here is a refactored version:

Message Edited by smercurio_fc on 01-23-2009 05:33 PM
0 Kudos
Message 3 of 9
(2,959 Views)

It works perfectly

 

Many thanks Smiley HappySmiley HappySmiley Happy

0 Kudos
Message 4 of 9
(2,934 Views)

Your suggestion used less modules than mine, but it required the 2d-Transose array after reading files (the way I use to read) ... then it works beautifully

 

Thanks Smiley Happy Smiley Happy Smiley Happy

0 Kudos
Message 5 of 9
(2,917 Views)
Why? You said your data was in columns. The Read From Spreadsheet File reads the file and you will get a 2D array with the data in columns. The zip file contained a file called data.rpt. Isn't this your data file? If so, using the exact code I provided will read this file just fine. Why are you transposing it? Are you wiring the constant of 0 to the "row" input of Index Array?  If so that is not correct. You should be wiring to the "column" input.
0 Kudos
Message 6 of 9
(2,907 Views)

I did exactly like you suggested & I had an error occur, I attach my .vi here just want to show you. The .rpt file is the same one in the zip file!

 

However, if I insert the Transpose 2D Array & in the combined Index array I put 0 for the first column (X),  1 for the second column (Y1),  2 for the third column (Y2) ... then it works very nicely! I know that it sound not as you suggested ... but I did try to probe the output without the Transpose 2D Array, then they show 3 data only 1 row!

 

Might be you know what I did wrong?

 

Thank

Message Edited by plit string on 01-26-2009 10:22 AM
Message Edited by plit string on 01-26-2009 10:23 AM
0 Kudos
Message 7 of 9
(2,861 Views)
As I suspected, you wired the constant to the "row" element of Index Array. Look at my picture carefully. You will see that I am wiring the constant to the "column" element since your data is in columns.
0 Kudos
Message 8 of 9
(2,849 Views)

Oopps, when I used the thead tool pointing to that 2nd input, I saw "disable column" (at that to time, I still connect to the row), that was why I confused & did not use it ... now it works as you suggested!

 

Many thanks for help & patient pointing out wrong connection Smiley Happy Smiley Happy Smiley Happy

0 Kudos
Message 9 of 9
(2,847 Views)