DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Truncating a data set

Hi, I have a data set which I derive a bending moment from, but I'm only interested in data up to that point. I currently manually find peaks of time by bending moment, copy the data into a channel view and delete all the data past the time stamp from the peak bending moment. Is there a way to automate this through a script?

 

Thanks

0 Kudos
Message 1 of 6
(2,105 Views)

Hi jfrost1, 

 

Are you using any of the Analysis functions  to calculate the peaks?  And have you tried recording the steps using the record function in the script tab? 

0 Kudos
Message 2 of 6
(2,066 Views)

Hi DanC12,

 

Thanks for answering, yes, using the data analysis at the moment, I've recorded a script to carry that out for me. What I'm then interested in is only the data up to that point. I'll have approx 50,000 data points to start with, the peak BM would be around the 30,000. I was wondering what script I could use to the remove 30,001-50,000?

 

Thanks,

 

James

0 Kudos
Message 3 of 6
(2,056 Views)

Hi Guys,

 

The simplest approach is to just redefine the official ending point of each channel array by changing it with the old ChnLength() / CL() function, like this:

 

ChnLength(Channel) = BendPointRow

 

Brad Turpin

Principal Technical Support Engineer

National Instruments

0 Kudos
Message 4 of 6
(2,039 Views)

Hi Brad, thanks for taking the time to have a look. Almost there with it, ideally I would like the length to be taken from the value from another channel. E.g. if I had one value in a channel, e.g. 10 in a channel named "[1]/Test"

 

ChnLength("[1]/Bending Moment") = ????

 

Thank you,

 

James

0 Kudos
Message 5 of 6
(2,034 Views)

Hi James,

 

The "old school" method to read out that new length value from the 1 value channel is this:

ChnLength("[1]/Bending Moment") = ChD(1, "[1]/Test")

 

R&D is going to suggest you migrate your code at some point towards using channel objects, but you should be fine with this for a good long while.

 

Brad Turpin

Principal Technical Support Engineer

National Instruments

0 Kudos
Message 6 of 6
(1,994 Views)