LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I write 1d array of 3 clusters to a dynamic data file?

I have a 1d array of 3 clusters that I would like to write to a dynamic data file (Write Measurement File vi), but I get an error that says I have an array for the source and dynamic data for the sink and won't let me do this. Fine, but how do I convert the array so I can write to the measurement file?

 

The array is a PSD signal and I really would like to write the signal to a file where I can retrieve it later. If conversion isn't possible or necessary, is there another file type that would be better or easier to use? I tried using a waveform to file vi and the error is that the sink is a double waveform. I tried coverting the PSD to double without luck. Maybe I need to append the waveform somehow? I could get it to dump to an excel either, but would rather have a text file to write to our database.

 

Thanks,

Mike

0 Kudos
Message 1 of 6
(7,894 Views)

mike.liebl@goodrich.com wrote:

I have a 1d array of 3 clusters


I'm not sure what this means. Do you mean you have an array of clusters, and you have 3 elements in the array?

 

There is no automatic conversion from an array of an arbitrary cluster to dynamic data because for an arbitrary cluster there's no way to know what the end result should look like. The Convert To Dynamic Data Express VI can only handle certain kinds of datatypes as the source. An array of clusters isn't one of them.

 

What is the structure of your cluster? Perhaps you can convert it to a waveform datatype. Alternatively, you can always simply write the data to a straight binary file. 

0 Kudos
Message 2 of 6
(7,888 Views)

Sorry for not clarifying better - I have a 1D array with a cluster of three elements. This data type is the result of the PSD signal setup I took from an example and wanted to write it to a file.

 

Thanks, I will first try to write it to a binary file and then try to convert it to a waveform datatype. Is that complicated?

 

Mike

 

 

0 Kudos
Message 3 of 6
(7,876 Views)

While you could convert it to a waveform datatype, it wouldn't make much sense since you're dealing with a cluster of 3 elements, and you have an array of clusters. A waveform datatype consists of a start time, delta T, an array of values, and optional attributes. How would your array of clusters convert to this? I suppose you could simply take all the numbers in sequence and make that your array of values for the waveform, and use a dummy start time and delta T.


Writing it out to binary file is not complicated at all. Just wire the array to a Write To Binary File function. Note that to read it you will need to know the datatype so the bytes can be interpreted correctly. Thus, reading this file from another program can be a bit annoying.

 

Another possibility is to simply write it out to an XML file using LabVIEW's XML schema, like this:

0 Kudos
Message 4 of 6
(7,872 Views)

You can do this fairly easily by converting your array or clusters into three parallel arrays.  You can then save in any file format that supports arrays (LVM, TDMS, etc.).  Here is an example using LVM (attachment is LV8.2.1).  It is not memory optimized.  You will also get t0 and dts of 0.  If that bothers you, you can use the output arrays of the FOR loop to build waveform data types and set the t0s and dts to something real.

 

Write3ElementClusterToLVM.png

Message 5 of 6
(7,848 Views)

You helped me so much with this 🙂

 

Since almost 2 days i was trying to acquire data from array to specific file and then append this data. U made my day better 🙂

0 Kudos
Message 6 of 6
(6,046 Views)