08-21-2010 03:35 PM
Hello, I use the Labview 8.2.1 and I create a diagram in my program.
The plot that is created isn't as accurate as the data of the *.txt file.
The data are in 2 columns, the left corresponds to x-axis and the right to y-axis.
Here is a sample of the data:
0-931
0.2-920
0.4-910
0.6-902
0.8-895
1-892
1.2-888
1.4-884
1.6-882
1.8-882
2-882
And here is an abstract of the diagram that corresponds to these data.
As we can see the the y-values 931, 920, 910, 902, 895 that correspond the the x-values 0, 0.2, 0.4, 0.6, 0.8 are plotted to the same x-value 0.
The rest values are plotted in the same way, that is, the y-values that correspond to floating x-values, are not plotted to the corresponding floating x-values but they correspond to the most significant digit of the floating number.
I tried to solve this problem by changing to 1 the Precision Digits in the "Format and Precision" menu of the "Waveform Diagram" but
the result is only in the appearance of the x-scale and not in the resolution of the plot.
What do I miss?
Hope I have been understood.
Waiting for an idea.
Thank you in advance.
Solved! Go to Solution.
08-21-2010 03:37 PM
Post your VI with the data saved in the controls as defaults so we can experiment with it ourselves.
08-22-2010 04:17 AM
I post the vi and a txt file that contains the data of the graph.
The file "sample_data.txt" must be placed in C:\
Thank you for your time.
08-22-2010 09:44 AM
You are reading the data as integers, so you lose all the fractional parts.
Go to the diagram and select Double as the datatype for the Read from Spreadsheet File VI.
Lynn
08-22-2010 09:53 AM
You've selected integer as the data type for the Read From Spreadsheet. Of course you will have the same x value for the different y points. The format and precision will not make up for discarding the decimal data.
What is the purpose of all that code? To plot the data, all you need is a single Index Array and a single Bundle function.
08-22-2010 10:13 AM
Dennis,
The dataset has two distinct groups of Y values, with the split occurring at index 163-164 in the array. If you plot the whole thing on one graph, much of the detail is hard to visualize. Without knowing the details of his data recording scheme, I cant tell how efficient his code is.
Lynn
08-22-2010 10:21 AM
Okay. Did not even see the comment on the block diagram. At first glance, seems a pretty ineffecient way to split the y data into 2 separate arrays..
08-22-2010 10:58 AM
Thank you for your replies.
It has to be double indeed, I didn't notice it.
Moreover, the decimal data must use the comma "," and not the dot "."
08-22-2010 02:08 PM
The color of the wire was a giveaway (and the word 'Integer' below the Read From Spreadsheet). If you are not aware that the wire color changes for different data types, you should check out the LabVIEW 101 tutorial.
08-28-2010 04:16 AM
After some days, I transfered the code to another PC and the diagram hasn't the same behavior.
The Labview in the first PC uses double numbers with commas "," and the second PC uses the dot "."
How can I check it and change it programmatically?