- Community Home
- :
- Discussion Forums
- :
- Most Active Software Boards
- :
- LabVIEW
- :
- zero crossover detection of 2d array text file

turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

11-20-2012 08:30 PM

Options

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

Drawing a blank on this. I have a text file that represents a 2d array of distance in column 1 and voltage out in column 2. Need to search file and extract the zero crossover value and the corresponding distance value. Once completed need to subtract the 2 consecutive values to determine the distance between the 2 crossover points. Have to do this for all zero crossovers.

So if my crossovers were at 11,21,32,41,51,61........ So 21 - 11 = 10, 32-21 = 11, 41-32=9, 51-41 = 10, 61-51=10......

Thanks so much for your help.

Happy Thanksgiving.......

Solved! Go to Solution.

11-20-2012 11:00 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

Various solutions seem quite easy to imagine !

What did you try ? Could you post some code from your own to clarify your problem, if any ?

Best regards,

HL

Solution

Accepted by topic author dg_lbe

08-27-2015 04:09 PM

11-20-2012 11:40 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

First get the data into LabVIEW (perhaps "spreadsheet to array" or similar).

Well you'll have a crossover when you have a -ve to +ve (or +ve to -ve) transition. [by this I mean going from <0 to >0 or >0 to <0, I'm ignoring positive and negative 0s]

So just move through until you find these transitions.

note: you'll also have to check for values=0 as they'll be a crossover but not a sign related transition (as defined above).

If you have a value=0 then the cross over is right there

if not, just use interpolation to find it.

You can then build up an array with the crossovers as you go through.

You can then move through that finding the differences.

11-23-2012 11:21 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

11-23-2012 11:40 AM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

Figured out the build array issue. Now just working on the differences of each reference.

11-25-2012 05:10 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report to a Moderator

I can't open your VI (I use an old version of LabVIEW) but I'd use a loop (the type is up to you).

Some pseudo code.

make an array_of_differences

i=number of elements in array.

for(k=0;k<i;k++){

current_diff=array(k+1)-array(k);

append_current_diff_to_array_off_differences

}

essentially iterate through all elements of the array except the last one, and find the difference between the current element and the next element (use index array to pull out the values), and then finding the difference is trivial. Then just put them into the array of differences how ever you see fit.

There are a few ways to do this;

1) just use build array in a loop, and add a new element onto the old array

2) pre initialise the difference array using the initialise array block and the number of entries based on the number of differences there will be (number of crosses - 1).

Not sure about the efficiencies or if there's anything in either method you need to be careful of, but hope that helps if you haven't got it sorted already.