12-16-2011 03:32 PM
I'm trying to build graphs using two groups of data in a TDMS file (timestamps and trend data). I've ran them through loops to cluster the timestamps with the appropriate data point. The first 32 samples in "Trend Data" go with the 1st sample in "Time". I thought the XY Graph could handle a cluster of data with timestamps and ys, but I'm sending it a 1D Array of a Cluster of Timestamps and Ys. I've also tried converting the timestamps to DBL and then setting the XY-Graph properties x-axis to time. Still no luck.
12-16-2011 03:42 PM
I'll attach my code in case someone is feeling really adventurous..
The .txt file is the .TDMS file; I just changed the extension.
I'm running LabView 2010 SP1
12-16-2011 03:43 PM
I've attached my code in case someone is feeling really adventurous...
12-17-2011 02:47 AM
Here's what I would do:
Here I've limited the number of reads, making the code faster, also I don't use build array inside the for loop, just make a 2d array that I resize to a 1d array.
This should plot 32 points at the the same x-sample.
Ton
12-19-2011 01:34 PM
That almost works...
Its writing:
t(0) to y(0)->y(95)
t(1) to y(0)->y(95)
t(2) to y(0)->y(95)
The final array has a size of 3*96= 288. We then resize to 96 and we have all 96 ys with t(0) timestamps, instead of
[t(0),y(0)->y(31)]; [t(1), [y(32)->y(63)]; [t(2),y(64)-y(95)].
Now, I end up with a 1D array of a cluster of two elements: time stamp and array of ys... and this can't be graphed. I wish I understood a little better how the auto indexing works...
12-20-2011 04:15 AM - edited 12-20-2011 04:15 AM
Why do you want to resize the array to 96 elements?
The 288 elements should have:
[t0, y0]
[t0,y1]
...
[t0,y31]
[t1,y32]
..
[t1,y63]
..
[t2,y287]
You don't need the array inside the cluster.
Each cluster should contain one x-point (time) and one y-point (trend) .
Your code doesn't index the inner for loop, you should do that.
Could you upload a sample TDMS file (zipped for instance)..
Ton
12-20-2011 07:59 AM
I pulled an audible on my code last night.. I found out about writing "interleaved data" rather than what I was doing with just one array that would end up being 32 x #Samples long. I've got to run into the plant, but this is what I have so far. I don't think my code is even close yet, but when I found out about the "interleaved" write ability I very quickly realized that was how I needed to organize my TDMS groups. I think it will make it way easier to build these graphs.
12-21-2011 02:09 AM
I'm wondering, but have you even tried my code?
Currently you have 4-dimensional array. that's something you cannot plot directly.
It's not about how you write your data, you don't need interleaved data to store what you want.
Ton