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: 

Find occurrences in multiple DAT files, where a set of signals are having a value of True.

Solved!
Go to solution

I have having multiple test data files and I am looking for if there is DIAdem script to parse through all these dat files and provide me the information about how many times a particular signals is set to TRUE.

 

Any help would be appreciated.

0 Kudos
Message 1 of 7
(3,342 Views)

Hello All, Can anyone help me with a script to find the a particular signals value to change to TRUE across in multiple DAT Files. There are multiple DAT Files of enourmous size and trying to do this manually is not very efficient.
Any help on this would be really appreciated.

 

 

0 Kudos
Message 2 of 7
(3,281 Views)

Hello John,

 

An example TDMS file would be helpful to know what data it is you are using.

 

I believe I have created a similar script before, what I did was: Create an additional channel for comparison, then populate this channel with the data of the channel in question however move all data points by one backward and remove the last data value in the original channel.

 

Now you can use an Event Search to compare A to B, the channels which return true show you detection changes. In this case however you want to know about when false becomes true.

 

To do this you can create a third channel decremented by 2 this time, then your comparison for a Event Search is: A != B And C = False. Kinda of like a position encoder.

 

This will however create a channel which has just a bunch of falses (or Nat a Value) and only trues when the state changes from false to true, there is a way around this also. You can then use other DIAdem methods to manipulate the data more towards what you need like creating a channel with the indexes, removing novalues etc... However I am wondering if there is not a function for this already. I would take a look through the DIAdem example finder.

 

I'm not at my development computer at the moment so cannot actually generate the code but if you could provide the data files that will help once I am?

 

Thanks,

 

Ed

Message 3 of 7
(3,268 Views)
Solution
Accepted by topic author JohnSingh

John,

 

If you haven't seen it already, you might find some help at the knowledgebase linked below:

http://digital.ni.com/public.nsf/allkb/FD7EB36833694FB986256B99005A6394

 

Brandon

Message 4 of 7
(3,266 Views)

Hey Brandon,

 

Nice find but since Find means iterating through multiple channels, instances of true and files would this not be extremely inefficient?

 

I would suspect EventSearch to be of greater efficiency and performance. I think I then used calculate with a condition to replace to move my true data and its corresponding time stamps to a new channel. In all, potentially it could even be scripted by recording the process from analysis. I'll know more when I'm in office tomorrow.

 

Edit: also, how would you use find for change detection of rising edge of digital signal? This would only show trues not specifically when false becomes true.

0 Kudos
Message 5 of 7
(3,261 Views)

Hello Ed,

 

Thank you very much for your response. I have sent a sample of the DAT file on PM for your reference. 

 

I am not very familiar with the DIAdem script but I should be able to customize if you have one from your example.

 

Regards,

Saurav

0 Kudos
Message 6 of 7
(3,242 Views)

Hello Ed/Brandon, EventSearch sounds like a good idea.

 

 

0 Kudos
Message 7 of 7
(3,239 Views)