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.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Change samplerate?

Hi!
I would like to change the samplerate on sevral channels from 10 khz to 2474 Hz.
Is that possible in Diadem? How do I do it?
 
Best Regards / Tomas Karlsson in Sweden
0 Kudos
Message 1 of 2
(4,358 Views)
Hello Tomas!
 
Yes, this is possible with DIAdem. The related function is 'ChnMapLinCalc'. There are different aproaches depending if you have a time or index channel or not. I had just the measured values so I had to generate two X channels with the 'ChnLinGen' function. Both with values from 0 to 1. The first with the length of the input channel, the second with the new length (input length * 2474 / 10000 in your case).
Option Explicit

' generate old and new linear X channels
Call ChnLinGen("LinXIn", 0,1,ChnLength("InputChannel"))
Call ChnLinGen("LinXOut",0,1,ChnLength("InputChannel") * 2474 / 10000)

' linear mapping
Call ChnMapLinCalc("LinXIn","InputChannel","LinXOut","InputChannel",true,"const. value",NULL,"analogue")

' garbage collection
Call ChnDelete("LinXIn")
Call ChnDelete("LinXOut")
Greetings to my beloved Sweden
 
Matthias
Matthias Alleweldt
Project Engineer / Projektingenieur
Twigeater?  
Message 2 of 2
(4,355 Views)