From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Extract User Specified Subset of Signal from Waveform Chart

Solved!
Go to solution

Hello,

I am trying to extract a user specified subset from a waveform chart. After the waveform is generated from a TDMS file, the user should select a range on the chart using the graph palette. I am using the Extract Subset from Signal Express VI with the Begin Offset and Length settings. The length I calculated from the user seems to be correct, but the minimum value that I want to feed into Begin Offset is not correct. How can I correct for this? Thank you.Capture1.PNGCapture2.PNGCapture3.PNG

0 Kudos
Message 1 of 6
(4,715 Views)

agin,

 

Thank you for attaching your code, it's always a lot easier to go through code than several screenshots. 

 

You said in your description that the minimum value that you wanted to feed into Begin Offset was not correct. Could you clarify what you saw when you ran the program vs. what you were expecting to see?

Patrick O.
Applications Engineering
National Instruments
Message 2 of 6
(4,650 Views)

Hi Patrick,

I have modified a little bit of my code since the last time, but still having some problems obtaining an accurate Begin Offset.

In my first picture showing the waveforms, the top left waveform data (Measured Data) starts at about 1:47:04.000

Let's say the user uses the graph palette and selects the range 1:47:10 to 1:47:20 from Measured Data. The graph then zooms in and only displays data from 1:47:10 to 1:47:20. I want to only extract the data from this subset that the user selected.

After clicking the Extract Subset button, I use the XScale.Minimum property of the graph and expect to get 10 seconds because the graph starts at 1:47:00. However, the value for XScale.Minimum is ~3E9. I found out this is the seconds since epoch 1/1/1904 (why this date instead of Unix epoch 1/1/1970??). I want to feed XScale.Minimum into Begin Offset, which appears to take relative time. So if I hardcode a constant of 10, it will correctly offset by 10 seconds. Length is calculated by subtracting XScale.Minimum from XScale.Maximum and has no problem.

 

I tried to solve this by first taking the XScale.Start (still measured in seconds from epoch) of the Measured Data before the user selects the subset, therefore getting the initial zero point. Then I allow the user to select the subset. I then subtract XScale.Start from XScale.Minimum of the user selected subset to get a relative offset in seconds. However, I encounter a problem where my extracted data is actually offset by ~4 seconds. So if the user selects 1:47:10 to 1:47:20 the extracted data is from 1:47:14 to 1:47:24. I think it is because my Measured Data starts 4 seconds after 1:47:00. Is there any easier way to obtain the data than using XScale properties?

 

0 Kudos
Message 3 of 6
(4,642 Views)
Solution
Accepted by topic author agin

Hi agin,

 

I made a small test VI to read the x range from a graph using similar timestamps as in your images:

check.png

 

When playing with the x axis it shows the x range correctly, both min and "diff"…

 

I found out this is the seconds since epoch 1/1/1904 (why this date instead of Unix epoch 1/1/1970??).

LabVIEW trivia: the epoch was take from Apple as the first LabVIEW version was developered for…

Trivia 2: it's all in the LabVIEW help…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 6
(4,638 Views)

Hi GerdW,

Thanks for the reply, it was helpful. But now I am still having some trouble with the extraction of the signal using the Extract Portion of Signal VI. I feed in XScale.Minimum into the Begin Offset (x-axis units) and I feed in the Length, but I do not receive anything from the Section output of the Extract Portion VI. Do you have any tips?

Thank you,

aginCapture4.PNG

0 Kudos
Message 5 of 6
(4,608 Views)

Hi agin,

 

sure I have "tips": get rid of ExpressVIs!

 

See this:

check.png

Instead of the flat sequence your should place a FromDDT function in your VI…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 6
(4,600 Views)