cancel
Showing results for
Did you mean:

Solved!
Go to solution

Hi All,

I followed the example below saving Spectrum Graph  and times into TDMS file format.  However, Diadem does not plot the data correctly.  Is there anyone know how to used Diadem to plot this TDMS data.

http://forums.ni.com/t5/LabVIEW/TDMS-2d-Array-Won-t-Append/td-p/1872743

Thanks

Message 1 of 5
(4,637 Views)

## Re: display tdms on diadem

Hello John,

your data contains those curious 0,0 tuples. You can see it very easly in the preview of Frequency.

So if you want to plot DBM over Frequency you can easily mark those 0,0 tuples using the "Band Cursor"

mark them using Set Flag and remove those values by selecting Flags: Remove Datapoints .

If you drop the channels to view again they will look nice.

Greetings

Andreas

Message 2 of 5
(4,608 Views)
Solution
Accepted by topic author John_vu

## Re: display tdms on diadem

Alternative you can use the following script to replace the 0 values by NoValues and use this channel to plot.

```Option Explicit

Call Calculate("Ch(""[1]/FREQUENCY_NV"") = Ch(""[1]/FREQUENCY"")*(1+CTNV(valequal(Ch(""[1]/FREQUENCY""),0)))")
```

Message 3 of 5
(4,606 Views)

## Re: display tdms on diadem

After I follow the example from the link above, saved datas to TDMS file, the 0,0 tuples is automatic generate in the datas set.  I believe they used that 0,0 tuples to seperate between my first data set with other sets.

If you look at my TDMS file, There are 3 channels.  Time, Frequency, and dBM.

Time: -- Time stamp every time I acquired a set of data.

Frequency & dBM : -- contained multiple set of data seperate by 0,0 tuples. (my data set have 1001 data point, " 0,0 tuples happen at 1002 index, New data set start after that, and so on.. )

What I really want that I able to plot each set of data seperately ("frequency vs amplitude (dBm) graph) with time stamp shown.

Second, I would like to make a replay macro that hop through all those data set (with timestamp) and display it on the screen ( Video replay if possible)

** I want to save my data to TDMS file this way, because it easy to manage data files.  It minimize amount of file that each data set must be created.

Message 4 of 5
(4,563 Views)

## Re: display tdms on diadem

Hi John_vu,

Here's a script that separates those different spectra into their respective groups, so that you can easily overlay them on a VIEW or REPORT graph.

```Call DataDelAll
IF NOT GlobUsedChn > 2 THEN Call AutoQuit
L1 = 1 ' Time
L2 = 2 ' Frequency
L3 = 3 ' DBM (Amplitude)
iMax = ChnLength(L1)
Size = ChnLength(L2)
ChnLength(L3) = Size
LastRow = 1
Row = ChnFind("Ch(L2)=0 AND Ch(L3)=0", Row+1)
Do While i < iMax AND Row > LastRow
i = i + 1
Call GroupCreate(RTT(ChD(i, L1), "#mm-dd-yyyy hh:nn:ss.ffff"))
Call GroupDefaultSet(GroupCount)
FreqChArray = ChnAlloc("Frequency", Row-LastRow) : FreqCh = CNo(FreqChArray(0))
AmplChArray = ChnAlloc("Amplitude", Row-LastRow) : AmplCh = CNo(AmplChArray(0))
ChnDim(FreqCh) = "Hz"
ChnDim(AmplCh) = ChnName(L3)
ChnComment(FreqCh) = ChnName(L2)
ChnComment(AmplCh) = GroupName(ChnGroup(AmplCh))
Call DataBlCopy(L2&","&L3, LastRow, Row-LastRow, FreqCh&","&AmplCh, 1)
LastRow = CLng(Row) + 1
Row = ChnFind("Ch(L2)=0 AND Ch(L3)=0", Row+1)
Loop
Call GroupDel(1)
Call PicUpdate```

National Instruments

Message 5 of 5
(4,498 Views)