LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Saving xy graphs to text files for slow data aquisition

Hi!

My program consists of 9 different graphs for a total of 67 separate curves (un-evenly distributed among the 9 graphs).

Each of the 67 curves gets one new point added approximately once every second (+/- 250 ms or so).

The graph system I use mimics a chart, but with variable dx (due to fluctuating data reception rate).

I am looking for an easy way to store the x and y points as they come in, into separate files. By separate I mean 1 file for each graph window (so each file will contain data for several curves!), for a total of 9 files.

The way I started out seems a little tedious, so I want to double check it with people here before I do a full blown implementation *see attached picture for details!*.

Basically, what I do now is, evertime a new set of data is received and decoded, I take the last entry in the graph "array of clusters", extract the xy array from the cluster, then from the xy array, I can get the x and y values of each individual curve in that graph. by indexing this xy array for each curve, I get data I can write to a file..

I would prefer to write to excel files, with each curve in separate columns, like "curve 1 x" in column A, "curve 1 y" in column B, then maybe skip a column for readability and add the next curve.

Now, can I do a "to string conversion" of the xy array and just kick it straight to excel, or do I have to manually extract each curve xy-set and build and rebuild a string array of curve xy-sets before finally writing to excel, or?
---------------------------------------------------

Project Engineer
LabVIEW 2009
Run LabVIEW on WinXP and Vista system.
Used LabVIEW since May 2005

Certifications: CLD and CPI certified
Currently employed.
0 Kudos
Message 1 of 3
(2,266 Views)
It is hard to really tell what you are doing from your code snippet and description, but it seems you are jumping through way too many hoops to do something rather simple.
 
First of all, it is much easier to write to a plain ASCII table, e.g. in CSV format (comma separated values) instead of the proprietary Microsoft excel format. *.csv files open in excel by default so you won't notice much of a difference.
 
In your loop, just open your file once, then append each formatted line as you go using low level file I/O. At the very end, outside the main loop, close the file.
 
I assume that as you are building the graphs, you already have the new data points available directly. Why not do the file operations right there? It seems like a detour to first merge it into the arrays and clusters and then extract it again.
 
In the upper part (3P status), you do seem to mimic a shift register using local variables. Shift registers are more efficient.
 
Why don't you attach your VIs so we see all of it?
0 Kudos
Message 2 of 3
(2,256 Views)
.. I did not attache it because it is big and messy , and this beeing an "on the side to graduate studies and teaching" I dont really have the time required to polish it at all...

That said, here is a zip with my LV 8 project and project files!

The Project file is located in the /gcs/ sub folder!

Things on my to-do list:

* Create comma formated outputs of all my charts

* Restructure my code to use a clean event driven state-machine "consumer producer" structures, using queues to implement state-change messages, and a separate queue for data collection and handling.

Again, I appologize for the mess, I try hard to make my own sub-vi icons, and comment the code I write, but I simply have not been able to keep up to my own standards this time.
---------------------------------------------------

Project Engineer
LabVIEW 2009
Run LabVIEW on WinXP and Vista system.
Used LabVIEW since May 2005

Certifications: CLD and CPI certified
Currently employed.
0 Kudos
Message 3 of 3
(2,251 Views)