08-26-2009 08:48 AM
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
08-26-2009 09:09 AM
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.
08-26-2009 09:53 AM
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
08-26-2009 10:15 AM
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:
08-27-2009 08:58 AM
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.
05-17-2014 10:31 AM
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 🙂