03-08-2013 01:14 AM
I want to write data to a .tdms file when a certain condition is met.
For example, when a signal reaches a value of 2, the data from 3 signals should be written to a .tdms file.
When a signal reaches a value of 5, it has to do the same thing.. And so on..
Could anyone help me with this? I haven't found any examples here..
03-08-2013 01:23 AM
place the "TDMS write" primitive into a case structure and depending on the signal's value decide what should be saved or not.
Hope this helps
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
03-08-2013 01:28 AM
Hmm, that's what I thought of in the first place.
But this is the problem, when I say " = 5" and the condition signal stays at 5 for some time, the data will be written to the .tdms for as long as it stays 5.
Is it possible to write the data only when the 5 comes for the first time. So just only 1 write.
03-08-2013 02:25 AM
Of course you can do that, it will simply require some more code.
Depending on how you signal is likely to vary, the number of sample you acquire an the rate you have to "design" a way to say "I only save to file the first value over 5 and then wait for the signal to go below 5 before I can save gain" or maybe what you need is "I only want to save values above or equal to 5 and i only save a value it it is different from the previous one".
So what is it exactly you want to do?
We have two ears and one mouth so that we can listen twice as much as we speak.
Epictetus
03-11-2013 05:27 AM
I only want to save to the file when the condition is true. The idea I had that when a condition is true, 1 pulse gets sent to the case. So that only 1 data is written. So in total 4 pulses, 4 data writes.
So a bool that is true should sent one pulse.. But I have no clue how to do this, because with a normal pulse pattern it will just send out a pulse for as long the signal is True