Point nearest of all in an array

Hello
I am having two  2 D array of  elements. Array1 and Array2.
I take a value from Array2 and calculate its distance from all the elements in Array1. I need to get the element which is at the shortest distance from it. How is it posible?
 I have made a VI.After calculating the distance how is it possible to check for the shortest and how to store that nearest value in an array??
 please have a look
Thanks 
Nghtcwrlr
********************Kudos are alwayzz Welcome !! ******************
Solved!
Go to Solution.
Attachments:
Nearest distance.vi ‏11 KB

While I did not quite understand what kind of output you want, here's one possible solution that can probably point you in the right direction. Good luck!
I assume you want the value of the nearest array element and I assume by distance you mean the 2D distance between the two points in the complex plane. Other interpertations would be to get the array indices of the closest value, for example.
Message Edited by altenbach on 03-12-2009 09:19 AM
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Nearest_distanceMOD.vi ‏14 KB
Nearest.png ‏7 KB

Similar Messages

  • I have two arrays of points, when i plot them there´s an intersection point, but this point doesn´t belong to any arrays...

    I have two arrays of points, when i plot them there´s an intersection point, but this point doesn´t belong to any arrays. I need to find the both value of this point, X and Y. I attached my problem in a very simple example. Thanks.
    Attachments:
    arrays_plot.vi ‏25 KB

    Although this doesn't directly answer your question , I've attached a VI that will hopefully give you a start and point you in the right direction. It generates a Boolean array that indicates between which indecies an intersection has taken place. Then, all you need to do is use triganometry to work out exactly what the intersection point is.
    Copyright © 2004-2015 Christopher G. Relf. Some Rights Reserved. This posting is licensed under a Creative Commons Attribution 2.5 License.
    Attachments:
    2x1D_Array_Intersections.vi ‏36 KB

  • All of a sudden my track pad doesn't work properly and mouse pointer is jumping all over my screen

    Help, it feels like someone else is controlling my mouse.  This just started happening.  My trackpad doesn't work or works sporadically.  While typing the pointer is scrolling all over my screen.  This is really annoying.

    Great tip! Your suggestion to check for a swollen battery in my laptop is working for me. You should get credit for solving the problem.
    On my MacBook Pro (2008), my cursor was out-of-control for the past couple of days, like it was having a sissy-fit. In TextEdit, for example, I would enter text, but the text would no longer be entered smoothly, in sync with my typing. Nor would the text appear where I wanted it go. Sometimes, the text I was typing, say in the last line of the document, would jump and insert itself somewhere above in the document. Sometimes, entire lines of text, or entire paragraphs, would get highlighted and then immediately deleted upon my hitting the next keystroke. Not an acceptable way to work!
    I tested this odd behavior in Leopard and in Snow Leopard and in Lion, which are all partitioned on my laptop's hard drive. Since I could not isolate the problem to any one version of the Mac OS, I began to fear that my motherboard had gotten compromised and went defective on me.
    Your tip proved that it was merely a swollen battery that was the cause of my problems. I was able to confirm this by removing the original battery (now 4 years old) and placing it on a hard surface. It rocked like a see-saw, ever so slightly, about 1/8-inch to 1/4-inch at the far sides of the rocking motion. When I looked at that original, swollen battery from the side, I got further indication that your insight was likely correct, for I could spy the area where the swelling was occurring: it was at an edge in the middle of the battery, and it was separating from the base by about 1/16-inch, just enough to make me wonder why the "springiness" had suddenly disappeared from the central portion of my trackpad.
    That change in the touch and the lack of aural feedback (i.e. no "click" sound or feeling) when I depressed the trackpad in the central section, was my first clue that something was wrong. The crazy cursor behavior on-screen was further indication that something was amiss.
    I type this reply under A/C power, as the replacement battery, which I had purchased from Other World Computing back in September 2011 for just such an eventuality, is now charging. At first, I was worried that the replacement battery was a dud, for it was stuck on 0% for nearly 10-15 minutes before it began to take a charge. But, 30 minutes of paience has paid off: the replacement battery is now at 15% and getting more powerful by the minute.
    bowlerboy

  • Small Black Vertical Lines follow my mouse pointer AND surround all ICONS

    Small Black Vertical Lines follow my mouse pointer AND surround all ICONS on my desktop. I just turned on my computer and it showed like this. I already tested my monitor and it's not the monitor.
    See a picture of my problem here on my me gallery:
    http://gallery.me.com/egarfias/100024
    Looking at websites, it's fine the display but any icons and my pointer and things that move have these lines following! Looking at VIDEO, it's the picture is full of white and black lines though you can see the video just fine.
    Any ideas? Thank you!!

    I am in Safe Mode now: This is the weirdest thing: A bit from column A AND B:
    The display is perfect EXCEPT for two parallel lines of 17, 3 millimeter-long black lines that follow the pointer everywhere it goes.
    Get this: my current display is 1024x768, but when I change it to 640x480, the pointer and everything is perfect! (of course, I can only see a fraction of my desktop)
    But then again... when I zoom in and out holding down control (in 640x480) the pointer lines appear again, but less lines. They disappear when I re-reset it to 640.
    Strange.
    But yeah, safe mode is NEAR perfect with the except of the cursor lines. I can screen grab my cursor though to show...

  • I need some help. im getting error -69 when trying to sync my ipod. i dont kno what to do. ive tried googling as much info as i can on this but i cant seem to find a answer to get me off to a good starting point. i back all my music up on a hard drive.

    i need some help. im getting error -69 when trying to sync my ipod. i dont kno what to do. ive tried googling as much info as i can on this subject but i cant seem to find a answer to get me off to a good starting point. i back all my music up on a external hard drive.

    If the file was not originally from iTunes, you'll need to redownload it from it's original source or rerip it from the CD.  Files can sometimes go bad and become corrupted.  As to how or why that happens, there are a number of ways.
    What format are the problematic tracks in? Have you tried converting them to another format in iTunes?
    iTunes: How to convert a song to a different file format
    B-rock

  • How to sum all bytes in array and remove carry/overflow ?

    Hi.. everybody !!
    I want to make bitwise operation in Labview. By the way,sum all bytes in array and remove the carry/overflow.
    Anybody has an idea about that ?
    Thanks

    If your array is an array of U8 type numerics, then all you have to do is sum the elements. This will return a U8. No carries. Sounds like what you're looking for.
    Rob

  • Will i get 2 T-shirts( POINTS SURE FOR ALL REPLIES TO THIS )

    hI
    IF I SURPASS 500 POINTS IN A SINGLE CONTEST WILL I GET 2 T-SHIRTS ONE FOR 250 AND FOR 500
    WHEN WILL THIS CURRENT CONTEST ENDS
    POINTS SURE FOR ALL REPLIES TO THIS

    Mohan,
    No need of giving points to this reply.
    If you surpass a particular milestone you will be rewarded with a t-shirt.That's it.It is not w.r.t to the figure 250.
    For 250 you will get a Orange colour t-shirt
    For 500 you will get a Blue Colour t-shirt.
    Definitely not two.
    For a milestone you will  be rewarded only with one t-shirt.
    I think this is not any contest which is gonna end,but a continious process to encourage SDNers to contribute more and more.
    K.Kiran.

  • Going through all elements in array

    Hi there,
    This problem has been getting to me and I know the answer is right in front of my face, so just wondering if someone can help point it out for me?
    I have a folder of files (txt, tdms, etc) and my code is set up to report back all the files on the folder and number of files as an array. Then I want to be able to go through each element 1 by 1 and use each sepearte element later on.
    The idea is I will have a folder where new files are constantly saved and I was this program to check the folder (in case it has been updated) and then for me to be able to use the new files as well. (eventually i will assign each element in the array to the end of a path so that each file will be called as the system goes through the array).
    I've tried this with a for loop, as in standard text based programming that is the go to way but when I run it like this in labview, it doesnt look like the system is running through the array. Is this just becaus eit is happening so fats,, it wont show on the front panel or have I missed something? I have attached the code
    Kelly
    Attachments:
    ArrayElements.vi ‏9 KB

    Kelly,
    accessing each individual item in the array is possible by using an "auto-indexing" input tunnel. Right-click your input-tunnel and select "Enable Indexing" for this. It is rather strange that it is not already like this as for for-loops, auto-indexing is default. Please note that with auto-indexing input-tunnels, you don't need to conntect the "N" terminal. Also, the "Index Array" function in the loop is not necessary as well (in fact, it will create a wiring error).
    Output-tunnels is the same... but in your provided example, the code will be "Rube Goldberg" as it does nothing else then to copy the array if you configure the output-tunnel to be auto-indexing. So this only makes sense, if you add some analysis functions in the loop which modify specific elements.
    Norbert
    CEO: What exactly is stopping us from doing this?
    Expert: Geometry
    Marketing Manager: Just ignore it.

  • How to declare a pointer to structure element which is array structures

     LStr, *LStrPtr, **LStrHandle structure is taken from LabView cintools extcode.h
       I used: sprintf(((*(*in_array)->Strings[*count])->str), local_str); to pass local_str string to
    LabView array.  It worked fine, but  one programmer adviced me to change code to  be more readable.
    Means - to change  (*(*in_array)->Strings[*count]) construction to a pointer. I tried many different
    ways to implement this - but in all cases it caused LabView to crash. I understand that this question
    is related to C programming not about LabView, but could you point me at a place where I have mistake ?
    The most likely incorrect string is " LV_array = &(**((**in_array).Strings[*count])); "
    Thanks in advance.
    1.  typedef struct {
    2.        int32   cnt;            /* number of bytes that follow */
    3.        uChar   str[1];         /* cnt bytes */
    4.  } LStr, *LStrPtr, **LStrHandle;
    5.      
    6.  typedef struct {
    7.        int32 dimSize;
    8.        LStrHandle Strings[1];
    9.  } LVStringArray;
    10.      
    11. typedef LVStringArray **LVStrArrayHdl;
    12.      
    13  _declspec(dllexport) void avg_hello(int *count, LVStrArrayHdl in_array)
    14.      {
    15.      
    16.       unsigned char *local_str="Entering function ma_in()";
    17.       (*count) = 0;
    18.       LStr* LV_array;
    19.      
    20.       LV_array = &(**((**in_array).Strings[*count])); //Set address to which should point LV_array
    21.       subfunc(count, &in_array);                      // Call a function which resizes array (works)
    22.       sprintf(LV_array->str, local_str);              //passing string to LabView (not working)
    23.      
    24. }
    Solved!
    Go to Solution.

    thank you Andrey Dmitriev! spasibo!
    With your example I understood where I have error in my code:
    I tried to assign to pointer an address of string which wasn't yet pre-allocated!
    that means simply swapping strings we get final code:
    1.  typedef struct {
    2.        int32   cnt;            /* number of bytes that follow */
    3.        uChar   str[1];         /* cnt bytes */
    4.  } LStr, *LStrPtr, **LStrHandle;
    5.      
    6.  typedef struct {
    7.        int32 dimSize;
    8.        LStrHandle Strings[1];
    9.  } LVStringArray;
    10.      
    11. typedef LVStringArray **LVStrArrayHdl;
    12.      
    13  _declspec(dllexport) void avg_hello(int *count, LVStrArrayHdl in_array)
    14.      {
    15.      
    16.       unsigned char *local_str="Entering function ma_in()";
    17.       (*count) = 0;
    18.       LStr* LV_array;
    19.       subfunc(count, &in_array);                      // Call a function which resizes array (works), First we resize array, and only after that we can assign an address of string to a pointer
    20.       LV_array = &(**((**in_array).Strings[*count]));  //Assigning address to which should point LV_array
    21.      
    22.       sprintf(LV_array->str, local_str);              //passing string to LabView (not working)
    23.      
    24. }

  • Cursor as Pointer Hand over ALL links?

    Looking to emulate what flash and browsers do for buttons, switch from the cursor to the pointer hand. It seems to happen to everything seen as a button but I need it to do that on all links. Suggestions? This is for an exe. presentation.
    Thanks

    just to chime in, this another "oops we did it again" by adobe.
    They claimed that flash was now used to build "applications" and in "applications" you don't get a pointer finger everytime you interact with a menu / button. So now the default behavior of interactive objects is to NOT show the pointer.
    They developed the original tv.adobe.com site using flash and it was a disaster. It was very bizarre and counter intuitive to interact with elements and not have the cursor change. The latest version of the site has been html-ized and all the ineractive elements now show the pointer. the site is better organized and a pleasure to use.
    It goes without saying that any interactive content in the context of a browser (99% of all flash deployment) should give you a pointer finger when you rollover. I guess they thought they could change a decade of user experience.
    For now you manually have to enable button mode when you want this "default" behavior. you could probably build an array of all your buttons and blast through to make the change... but its still work.

  • How to add all element of array?

    1-D array has N number of element .i want to sum all the element ,and the result is a number.
    can you give me some example?
    thanks.

    Just use the "Add Array Elements"-function located in the Numeric palette.
    Message Edited by becktho on 02-21-2006 12:58 PM
    Using LV8.0
    Don't be afraid to rate a good answer...
    Attachments:
    AddArrayElements.PNG ‏14 KB

  • Mouse Pointer resizes when applying pointer style to all

    When Captivate records my SW demo, it uses up to three different mouse pointer styles at different times (Haven't quite figured out what the protocol is).  I really don't like this and would like only one style used (the hand).  So when I right click on the hand pointer on a slide, and choose "Use the current mouse pointer for all slides," any pointer that was automatically changed to the hand pointer is much smaller (shrinked by 50%) and I still have to end up manually selecting the hand pointer for each one.
    Does anyone know why this is happening?
    Is there a way to select a default or standard pointer to be used at all times?
    TIA,
    Vicky
    Captivate 8 user

    Here's the shortest code with the problem I could come up with.... You can run it if you create two different default paragraph styles: 'Product - Description' and 'Product - Title No Indent';
    The problem is that the first line should have 'Product - Description' style, but it instead it gets 'Product - Title No Indent'.
    If I comment out one of the paragraphs, everything works fine. What's wrong?
    var doc = app.documents.add(),
        product, text_frame, i, l;
    product = {
        'text': [
                'style': 'Product - Description',
                'text': 'Designed for monitoring sterilization processes.'
                'style': 'Product - Title No Indent',
                'text': 'Designed for monitoring sterilization processes.'
                'style': 'Product - Description',
                'text': 'Designed for monitoring sterilization processes.'
    text_frame = doc.pages[0].textFrames.add();
    text_frame.geometricBounds = [ '0pt', '0pt', '240pt', '300pt'];
    for ( i = 0, l = product.text.length; i < l; i++ ) {
        text_frame.contents += "\r" + product.text[i].text;
        text_frame.parentStory.paragraphs[-1].appliedCharacterStyle = doc.characterStyles[0];
        text_frame.parentStory.paragraphs[-1].applyParagraphStyle(
            doc.paragraphStyles.item( product.text[i].style )

  • Deleting all elements from array and array to spreadsheet string

    Hello,
    I would like to write a new data file for each "recording" session without closing the VI.  My problem is that the last "recording" session's data is at the top of every successive session's text file.  I do not want this.  I've tried to delete all rows from the array after my array to spreadsheet string function, but I think the problem is somewhere with the shift register and how the array is built.  I'm not too familiar with LabView and this aspect of my interface is driving me crazy.  Attached is my code and two successive data files.  I have not been able to find a solution on these or the LAVA forums.  Any help would be appreciated.
    Also, I know there is an easier way to write this kind of streaming data, but I need to do it this way for other devices and synchronization purposes.
    Attachments:
    testsecond.txt ‏90 KB
    test41.vi ‏80 KB
    testfirst.txt ‏78 KB

    A few more comments to your code:
    Your loop does not have a wait, meaning it spins the empty case millions if times per second, consuming all CPU while not doing anything. Add an indicator to [i] to see.
    To clear a 2D array in one case frame, just don't wire the output tunnel and set it to "use default if unwired". You'll get an empty array. No fancy tools needed.
    I probably would use an event structure and also protect the data if the save dialog is canceled.
    Here's a simple draft that probably requires a bit more work but should show some of the ideas.
    You should also
    add some protection that the VI cannot consume all available memory if it runs forever.
    Create a seperate case to save the data later if the file dialog is cancelled the first time.
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    test41MOD.vi ‏107 KB

  • Georaster return all values in array

    Hello,
    I want to return all values of the raster in a array, to display it in a web page.
    Is there a function which return that values in one query ?
    Thanks

    So far, there isn't a function which returns cell values in an array, but you can call SDO_GEOR.getRasterSubset(*)  to get raster data in a blob, and then using functions defined in the dbms_lob package to get raster data.

  • Dual layer point break and all this young things in the mood

    thanks to all the forum crew, after month of works on several dvd-9 project i can resume for the rest of the world the key success to make a right point break :
    first create in automatic , if it's work don't try more , burn it and test it on a set top dvd player. if your happy with it don't try more and keep your time for pleasure.
    personnally it doesn't work oftenly and worst a project that was burn 25 times was unburnable 15 days later how does it possible, even in toast and even after create again and again so no choice i had to try put the point break manually
    first go in your VIDEO TS folder select all the files watch the properties then now select about the first half of the files and watch on the propertie when you got about 4 gig this will be your layer 0 watch the last selected clip using videolan (vlc) this is the clip where you'll try tu put manually the break point. then the nightmare start : put a breakpoint marker on the timeline create the folder and then try tu burn you can have two kind of error the layer 0 is too big in this case try to put your maker before or the layer 1 can't be bigger than the 0 so put your marker after
    about toast , toast save me sometime because it set in auto the marker differently from dsp so its like another try out in the big point break game but in truth each time i used toast the replication factory send me back the dvd even if it was properly working on a set top player it wont fit for replication.
    my studio upgrade is waiting this projects are over and replicated because im quiet to scare to upgrade such software in the middle of a projects.
    at last as a recomandation for the developers why dsp give us this choice when i put manually my break point i had no choice where to put it i try every way until it works there is no way to choose if you want burn it
    last but not least why can't we export the subtitles done on DSP this is a big mess to copy this huge part of the job from a project to another an export option on stl format would be great
    and a very important question to finish wich scsi card shall i buy to connect my DLT IV quantum 4000 on my G5 (at a reasonable price) i prefer ask it here as i use this dlt only for dvd mastering and some people tell some scsi chip/card doesnt work with dsp

    Silly question but brilliant answer lol that is the case lol the data is coming out at 4.3Gb on one disc and 4.19Gb on another so I can run with single layer discs :-)
    Thanks again, I suppose I should check these things when people ask me for solutions lol although I expect them to check something like that lol
    Thanks again
    Dan

Maybe you are looking for