LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

search 2d array and extract index

Need a little help with a simple problem.

 

I'm working on an image correlation project where the end result is an array MxN

 

all of the values of my array vary between -1 and 1 and I need to extract the indexes (row and colum) of this 2D that are greater than or equal to 0.9.

 

The row corresponds to a specific point of an intensity graph and the colum to a point on another image. 

 

Any guesses as to how to extract my indexes?

 

 

Thanks in advanced

 

 

Bruno Noronha

Certified LabVIEW Associate Developer





Using LabVIEW 8.6
0 Kudos
Message 1 of 10
(4,204 Views)

Use a nested while loop?  Have you attempted this problem?

0 Kudos
Message 2 of 10
(4,192 Views)

Hi Bruno,

I attached a quick vi showing how to do this. The first part generates a 2D array while the second part of the flat sequence generates row and column values. I did look at Search and Threshold 1D array, but couldn't come up with anything.

Hope this helps.

Rick

0 Kudos
Message 3 of 10
(4,183 Views)

Sorry. This one will run on LabVIEW 8.0+

Rick

0 Kudos
Message 4 of 10
(4,179 Views)

This seemed to have been a university course problem, and there was no apperent attempt at the problem.  Why are source code answers being given?

0 Kudos
Message 5 of 10
(4,172 Views)

 


@Been bitten by LabVIEW wrote:

This seemed to have been a university course problem, and there was no apperent attempt at the problem.  Why are source code answers being given?


Maybe the example answer given above is a trap?! 😄

 

 

From a first glance, it is buggier than an ant farm and overly complicated and inefficient 😮

 

 

  • There is no reason for the sequence frame. Why is is there?
  • The shift register is not initialized, meaning the output array grows with every run.
  • A control terminal in placed in the innermost loop. Very inefficient.
  • Never heard of auto-indexing.
  • ...
😉

 

0 Kudos
Message 6 of 10
(4,162 Views)

Hmmmm, well I never looked at it since I can't read anything above 7.0 at the moment.  Enjoy.

0 Kudos
Message 7 of 10
(4,158 Views)

The code was not meant to be perfect as it was thrown together in just a few minutes.

The sequence was just to show that the two are seperate.

There was no need to initialize the shift register to demostrate a point.

Yes, I have heard of auto-indexing, it is used to build the 2D array. For some reason I was running into problems with the second loop.

 

Maybe next time your comments can be more constructive instead of bashing other peoples' example code.

How unprofessional for a professional site.

Rick

Message 8 of 10
(4,135 Views)

 


rpage wrote:

 

Maybe next time your comments can be more constructive instead of bashing other peoples' example code.

How unprofessional for a professional site.


 

I agree that it is quite unprofessional to throw out example code that is highly flawed and showcases bad coding habits. The new users here seeking advice deserve better. I am serious! I can guarantee you that the users will run the code more than once, so having the uninitialized shift register can lead to serious confusion.

 

Thus my constructive criticism, mentioning some of the flaws. 😄 There was no bashing intended, and if you feel I did, I am sorry. Maybe I will use a few more smileys next time. :):):)

 

Here's how it should have looked like. I would guess it would have taken faster to code because there is less code to do the same thing. (no index array, no need to wire the N's of the second loop, no flat sequence, fits on a laptop screen, ...)

 

 

 

I am by no means perfect, for example I misspelled one of the indicator terminals 😄

Message 9 of 10
(4,115 Views)

@altenbach,

Yes, I should have cleaned it up better. Sorry for the snappy attitude. The day had not started out well and I obviously took your comments in a way that you had not intended. Thanks for clarifying with the image. When you were talking about auto-indexing, I assumed that you were talking about my use of shift registers instead of auto-indexing to come up with the final results.

Rick

Message 10 of 10
(4,094 Views)