LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sorting data into multiple columns

Hello, I'm trying to create an array that I can output to a spreadsheet file. I'm sampling based on time, and I'm doing some data analysis within the program. I want to format the array to be like this:

 

| Current time | Airflow | Volume | x | y | z |

 

and have this for each time point. I can do this with a single signal but I'm having issues with the multiple data entries. The time is controlled by an input to the timed structures palette.

 

 

Here's a screencap of what I have. I'll be adding more signals to the output as I go. I'll also include the VI.

 

Thank you!

 

snipp.PNG

0 Kudos
Message 1 of 2
(2,258 Views)

What I would do is create a typedef cluster containing the data that you know you will want to write for each update. In this case, you will create a cluster with a timestamp control in it and two floats - for the three values you know about now. Do not forget to label the controls for what they will contain.

 

VERY IMPORTANT: After creating this cluster, save it as a typedef!!!

 

Now create a VI that takes that cluster as an input. Inside that VI, format the data from the cluster into a tab-delimited string and append it to the end of a file.

 

Finally, bundle the three values that you have now and wire it to the cluster input of the VI you just created. Now as you add new values that you will want to save, you will need to add them to the typedef, add the formatting code inside the subVI, and add the value to the input cluster.

 

Mike...

 

As an exercise for the reader:

You will probabliy also want to add some mechanism to your data saving VI to:

  • Allow you to specify the path of the file to which you want to write, 
  • Handle/report errors

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 2
(2,215 Views)