LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Intensity Graph to XY graph

Solved!
Go to solution

Hi, I´m working with LabviewRobotics, generating a matrix (occupancy grid), the values in the matrix are 0 or 100. 

I want to plot this information into a XY graph, where 100 will be a point in the graph.
What I need is to get all the combinations (x,y) where the matrix element has the value of 100, anyone know how to do this in a simple way?

0 Kudos
Message 1 of 8
(4,247 Views)

Autoindex the 2d array on a stack of two FOR loops and build an array based on the two iteration terminals in the innermost loop, auto indexing using a conditional a output tunnel. Use a concatenating tunnel on the outer loop.

 

0 Kudos
Message 2 of 8
(4,243 Views)
Solution
Accepted by genzo436

For some reason I cannot post the VI (it says file extension does not match the file type). Here is a picture of my block diagram for now. False case just wires the arrays straight through.

Message 3 of 8
(4,236 Views)

@Gregory wrote:

Here is a picture of my block diagram for now. False case just wires the arrays straight through.


Why is the scalar control on the innermost loop? That belongs outside because it should not change during the execution of the loops!

 

With modern LabVIEW versions, here's how my suggestion would look like. Arguably much simpler. (note that xy graph accept complex arrays directly)

 

 

 

(Of course you can swap the indices depending on how you want the output arranged.)

 

Alternatively, you could reshape to a 1D array, use "search 1D array", and transform the 1D indices back to 2D using quotient&remainder. 

 

Message 4 of 8
(4,227 Views)

I learned a couple neat tricks there!

0 Kudos
Message 5 of 8
(4,207 Views)

It worked really fine, I was trying something similar, but i couldnt actualize de values, the shift registers was the part I was missing, thank you

0 Kudos
Message 6 of 8
(4,137 Views)

Hey, thank you, I dindn´t know i could send complex to an XY graph, I´m reducing my code now in different parts thank to this... nice tip

0 Kudos
Message 7 of 8
(4,132 Views)

@genzo436 wrote:

 the shift registers was the part I was missing, thank you


I wasn't using a shift register either. Do you have an older LabVIEW version?

 

Here are some alternative versions that don't use fancy tunnels. Same difference.  😄

 

 

0 Kudos
Message 8 of 8
(4,128 Views)