10-05-2020 08:49 AM
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
10-06-2020 11:15 AM
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?
10-07-2020 03:49 AM
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
10-07-2020 04:36 PM
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
10-08-2020 10:01 AM
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
10-19-2020 05:13 PM
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