Can you save all the values of the UserData field of a data acquisition session?

1 次查看(过去 30 天)
I'm acquiring data through a NiDaq device and have created a data acquisition session.
There are two fields that I created using the UserData (src.UserData.trip_type and src.UserData.trip_counter) .
I'm updating the values of these two fields when certain conditions are met (a voltage threshold) by one of the signals I'm acquiring.
This means that my UserData fields keep changing once those conditions are met, but I would like to constantly record their values, and get the timestamp of when their value changed. Is there a way to do that?
Thanks.

回答(1 个)

Aman Vyas
Aman Vyas 2020-8-13
编辑:Aman Vyas 2020-8-13
Hi Melanie,
  • Would it make sense to log the data and count it later?
  • pre-calculate the zeros() and store them in a variable instead of having the zeros() inside the loop
You can use this:
mean(diff(acqData))
which is going to be identical to
(acqData(end) - acqData(1)) / (length(acqData) - 1)
You can look at "Acquire Timestamped data" section for more info in the following link:
Hope it helps!
  5 个评论
Aman Vyas
Aman Vyas 2020-8-13
编辑:Aman Vyas 2020-8-13
For ni devices use the following documentation and refer to the "acquire data in the background" section. https://www.mathworks.com/help/daq/examples/log-analog-input-data-to-a-file-using-ni-devices.html
Also, you can take a look at this matlab answer which shares various techniques to do scontinuous and background acquisition. Link
Hope it helps !
melanie basnak
melanie basnak 2020-8-13
Oh but I am already doing that! I am acquiring my NiDaq data in the background, and I have a listener, which is calling that function I pasted up there. The variables that I want to store are not the voltage signals picked up by the NiDaq themselves, but rather these new variables I'm creating into the UserData of the session.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Simultaneous and Synchronized Operations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by