<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Searching data points in a cluster in LabVIEW</title>
    <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286294#M960403</link>
    <description>&lt;P&gt;Use the "cursor index" property and index into the array of point of the xy graph. (I would even use a complex 1D array instead)&lt;/P&gt;&lt;P&gt;Similarly, if the sensor data is also in an array withe the same number of points and arranged the same way, index into those to to get the seonr data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/960403/1/CursorIndex.png" border="0" alt="" title="" /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 23 Apr 2016 18:54:07 GMT</pubDate>
    <dc:creator>altenbach</dc:creator>
    <dc:date>2016-04-23T18:54:07Z</dc:date>
    <item>
      <title>Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286286#M960396</link>
      <description>&lt;P&gt;Hello.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using LabVIEW 2013 for myRIO. Im facing a problem with implementing a few things with clusters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Problem Statement : Map co-ordinates logged from a GPS onto a map and use cursor functionality to check value of different sensors on different parts of the track.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been able to map the logged co-ordinates onto a map in LabVIEW. I create an array of the co-ordinates, bundle them and then feed it to an XY graph. Cursor has also been implemented. I click the map and drag my mouse and it takes me to various co-ordinates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I cannot do is display the other senors data for those co-ordinates of X,Y.&lt;/P&gt;&lt;P&gt;My plan is to bundle all the sensors data into a cluster and then try and search the cluster for needed points of X,Y.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I search within a cluster specifying only X,Y&lt;/P&gt;&lt;P&gt;eg: I give X,Y and i get the value of all sensors for that pair of X,Y ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:15:23 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286286#M960396</guid>
      <dc:creator>deepen_solanki</dc:creator>
      <dc:date>2016-04-23T18:15:23Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286287#M960397</link>
      <description>&lt;P&gt;We would understand&amp;nbsp;&lt;U&gt;much&lt;/U&gt; better what you are doing if you attach your&amp;nbsp;&lt;U&gt;code&lt;/U&gt; (the VI or a ZIP file with the entire Project). &amp;nbsp;It would also be a good idea to give us some idea of the expected magnitude of the problem -- for example, if you are talking about 5-10 clusters, a brute-force "test every cluster" is certainly easy to program and probably within a factor of 2-3 of the best you could do.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bob Schor&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:27:47 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286287#M960397</guid>
      <dc:creator>Bob_Schor</dc:creator>
      <dc:date>2016-04-23T18:27:47Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286289#M960398</link>
      <description>&lt;P&gt;XY graphs take a rich variety of data types so you have a choice to pick the best representation for the problem. (complex array, array of points, cluster of x and y arrays, etc)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am assuming you currently have an array of xy clusters ("points") and not some fancy more complicated clusters. Is the data quantized to a grid or does it have near infinite resolution? Do you want the closest sensors (e.g. sorted by distance from the clicked coordinates) or only the exact locations?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, please show us some simplified code with simulated data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:39:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286289#M960398</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-23T18:39:03Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286293#M960402</link>
      <description>&lt;P&gt;Okay, as of now what I am doing is creating two random arrays of X and Y co-ordinates to plot on the map and creating 2 more arrays of random numbers to represent sensor data. All this has been combined into a cluster. Now what I want to do is input X,Y and find the data value of the other sensors for that pair of X,Y. Basically I want the data of all sensors at that co-ordinate of the map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Attached is a very rough VI I am working with&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:45:18 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286293#M960402</guid>
      <dc:creator>deepen_solanki</dc:creator>
      <dc:date>2016-04-23T18:45:18Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286294#M960403</link>
      <description>&lt;P&gt;Use the "cursor index" property and index into the array of point of the xy graph. (I would even use a complex 1D array instead)&lt;/P&gt;&lt;P&gt;Similarly, if the sensor data is also in an array withe the same number of points and arranged the same way, index into those to to get the seonr data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/960403/1/CursorIndex.png" border="0" alt="" title="" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:54:07 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286294#M960403</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-23T18:54:07Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286295#M960404</link>
      <description>&lt;P&gt;for example like this....&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://ni.lithium.com/ni/attachments/ni/170/960404/1/CursorIndex2.png" border="0" alt="" title="" /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 18:57:33 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286295#M960404</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-23T18:57:33Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286300#M960407</link>
      <description>&lt;P&gt;Why doesnt this work ?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 19:17:26 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286300#M960407</guid>
      <dc:creator>deepen_solanki</dc:creator>
      <dc:date>2016-04-23T19:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286312#M960416</link>
      <description>&lt;P&gt;Also, where is the part where I can search for sensor data giving X,Y as inputs ?&lt;/P&gt;</description>
      <pubDate>Sat, 23 Apr 2016 19:54:05 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286312#M960416</guid>
      <dc:creator>deepen_solanki</dc:creator>
      <dc:date>2016-04-23T19:54:05Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286322#M960423</link>
      <description>Sorry, posting by phone. Cannot see your VI. Make sure the cursor is locked to a plot (obviously does not work with free cursors). As I said, if your sensor data is arranged as your points, there is no need for "searching".</description>
      <pubDate>Sat, 23 Apr 2016 21:15:14 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286322#M960423</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-23T21:15:14Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286344#M960431</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://ni.lithium.com/t5/user/viewprofilepage/user-id/325715"&gt;@deepen_solanki&lt;/a&gt; wrote:&lt;BR /&gt;&lt;P&gt;Why doesnt this work ?&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;OK, looking at you code...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't expect it to work, because&amp;nbsp;none of it makes much sense.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try something along my earlier suggestion. Here's a very rough draft.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2016 06:33:25 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286344#M960431</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-24T06:33:25Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286353#M960434</link>
      <description>&lt;P&gt;@altenbach&lt;BR /&gt;&lt;BR /&gt;I am attaching the code I wrote, but I must say, your code is beautiful. It is exactly what I wanted.&amp;nbsp;&lt;BR /&gt;Can you briefly explain how this works ?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you ! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2016 10:00:22 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286353#M960434</guid>
      <dc:creator>deepen_solanki</dc:creator>
      <dc:date>2016-04-24T10:00:22Z</dc:date>
    </item>
    <item>
      <title>Re: Searching data points in a cluster</title>
      <link>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286397#M960468</link>
      <description>&lt;P&gt;Your code has several problems, for example equal comparisons on DBL are always problematic once you have real data. If X and Y are always integers, you should use a blue datatype.&lt;/P&gt;&lt;P&gt;Looking at your new code (Please give the VI a new name when attaching new and different code!!!): SInce there is an absolute upper limit on the number of iterations, you need a FOR loop, not a while loop. You can show the conditional terminal to stop early if needed. I would also rewrite the boolean logic. It would be much easier to understand using "stop when true", removing the "NOT", and adjusting the other comparisons.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There is also "search array", which would work perfectly using complex data. (See attached draft).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to my code: data for an xy graph is an ordered set of points (irrenspective of the exact representation (complex array, array of ponts, clust of x and y arrays, etc.) and if a cursor is locked to a plot (as in your case), only valid points can be selected. The current cursor has an x and a y, but also an index (Cursor.Index) that tells you which one of the data points is current.ly under the cursor. You can also get the same data out of a cursor move event data node&amp;nbsp;(Point.Idx). (It is somewhat unfortunate that the same function is named differently between events and property nodes, but that's how it is...)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Note that I rearranged the data as array of scalar clusters (instead your cluster of arrays), by using a FOR loop, It is more suitable for the problem. You get all values using a single index whereas in your arrangement it is more difficult to access the values.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 24 Apr 2016 15:43:11 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/LabVIEW/Searching-data-points-in-a-cluster/m-p/3286397#M960468</guid>
      <dc:creator>altenbach</dc:creator>
      <dc:date>2016-04-24T15:43:11Z</dc:date>
    </item>
  </channel>
</rss>

