LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to plot graph from data in.txt format

Hi there,
 
I want to ploat graph from taking data from txt file, i was using origin and out put of it also attached, The output of Labveiw came something different, i want to compare both, how can i ploat this text file in to the labview?
 
In txt file:- fist column is showing time and second column showing appropriat data at that time.
 
thanking you in advance
dipen
0 Kudos
Message 1 of 10
(4,237 Views)

Hi,

The attached pic will help you solving your problem.

Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 2 of 10
(4,231 Views)
Hi dipen,

attach is my version of the vi. You can do the transposing in the read function or you can use the array index afterwards, (as shown above). You also should use an XY-graph instead of a waveform graph...
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 10
(4,225 Views)

HI Jorge,

yesterday you sent me one PNG file, in that all availabe in labview 7.1? I have attached it with mark on it

thank you

raj

0 Kudos
Message 4 of 10
(4,192 Views)
Hi raj,

this vi is called "Read from spreadsheet file" in LV7.1.
It reads spreadsheet files and ouputs them as SGL arrays (1D or 2D). The output behaviour was changed in LV8+ hence the different look with a selector...
But you can use the LV7.1 version as well. Or you read in simple text (Read chars from file) and do the conversion using "Spreadsheet string to array" as you can control the output datatype.
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 10
(4,188 Views)

Hi GerdW,

I tried to build as per your suggestion, but the result is not coming same, i am getting one extra diagonal line, this is not coming with Exel or origin, second thing is in original txt file first two column indicating just date and present time, third and forth column is indicating x and y axis data. how can i select third column and forth column, i tried to do index third and forth column but it is not working in my case. Can you please explain how this array indexing works..I have attached one txt file as original name and other txt file containing only x and y data.

thanx

raj

0 Kudos
Message 6 of 10
(4,182 Views)

HI again,

 

That happens because you have the last lines of your file are like this:

4381,6001 10,33877
4381,7001 11,52896
10,59817 
10,46084

The last elements don't have match and you have an empty line. Try to clear these lines and run again.

Software developer
www.mcm-electronics.com





PORTUGAL
0 Kudos
Message 7 of 10
(4,172 Views)
Hi raj,

the diagonal line was already explained by Jorge...

For your original text file: it's a kinda weird format with mixed separators (space and comma). And much more important: it contains date/time-data!!!
The standard function (read from spreadsheet file) will convert the date/time values wrong because of all those ".",":" and "," in between, that's why you have to convert this "by hand":
- read in as text
- convert to array of strings ("spreadsheet string to array") using space as separator
- get the 3rd and 4th column, convert them to numbers, build your graph


Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 8 of 10
(4,167 Views)

Hi again,

Now i got  problem of diagonal line, but not other, do you mean i have to import file to Excel everytime and select 3rd and 4th column and copy it to text file then import and plot graph. This will not be a good solution because this is only  around one hour data, this program which i am going to make will have to run for more then 10 days continously and the same time i want to display graph on screen. is there any other solution?`

Thanx in advance

raj

0 Kudos
Message 9 of 10
(4,156 Views)
Hi raj,

no I didn't meant to use Excel at all.
Attached you find the solution made in LabView7.1. (I hope the conversion is right as I don't want to change my regional settings...)
To get the columns is rather easy as your text file uses tabs as separators.

Changed attachment: now the last 2 rows are deleted as they contain wrong values!



Message Edited by GerdW on 01-24-2008 04:28 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 10 of 10
(4,148 Views)