07-08-2010 10:51 AM
I feel this is a simple question, but I am over thinking it. I am trying to make a program that takes data that is sent threw serial Rs232 from a device, and put that data both into a file and display a live graph of the data (saving the graph would also be great). The devise is strait forward it gives me data when it is don't making the test. After it has the data is sends it and it is always in this form, (ignore Quotes) "[ 122.8 PSI ]' where "122.8" will always be 5 characters and the decimal point stays the same.
I would like to take Ex. 122.8 and plot that on y and use the line number from the text file as the x value. How can this be achieved?
Currently I am displaying the values in a list because I can't figure the graph out. But attached is my messy code and a sample of data that gets sent.
P.S.. The data list can get as long as 2000 or more.
side question... when the program is built into an EXE when using serial, can the user change what port?
07-08-2010 11:14 AM
Well, that's called Rube Golberg code.
All that you have to do is convert the string to a numeric (i.e. a single Scan From String not your match pattern functions) and wire it to a chart. The chart's x axis by default will increment by 1 with each sample written so reading the x axis from file is silly. Be sure to set the chart history. Since you are already writing the data to file, why write it again? Either write the full string or just the value. Your second while loop becomes unnecessary and if for some reason you needed it, it would only record the very last value.
Don't open the file with each iteration. Place that outside the loop.
You might want to take the free LabVIEW tutorials.
07-08-2010 01:47 PM
Thank you so much for your fast reply. I am beginning the long journey of learning labview, have done labview programming on an FRC team, but again as you use the same terms the other programmers did, I use the Rude Goldberg method of programming. It still gets the job done just extremely taxing on the processor. I have invested in learning but I don't start until august.
Another question, is it possible to use the same data to quickly give the Max, Min, and Average values as well as the Standard Deviation.
07-08-2010 01:55 PM
Unless you build an array of value or use the History property node (an array), you would use the Point By Point functions to give you those results.