Search Indices in 2D Array in a Range

Hello.
I have two 2D Arrays (9x9) and I would like to find indices of an element that lies in a specific range. For example, ±15% of the value I look for. I have found and implemented Search 2D Array.vi, it works well but it is possible to set only one number to search for, not a range. So, I am stuck at this stage.
Any help is highly appreciated!
Thanks.
Solved!
Go to Solution.
Attachments:
Search 2D Array LV2013.vi ‏17 KB
Search 2D Array LV8.5.vi ‏19 KB

Lynn,
I am confused a bit. Please look at the attached image. Range is 0,54-0,66. I think that the first value in Indexes array is number of row and the second is number of column, am I right? If so, (0,0) corresponds to 0.678852, (0,2) is 0.209174 which is out of the range. But (1,0) is 0.574114 which lies within the limits. However, somehow 0.56365 and 0.652643 (circled in green) have not been detected...
Another question is what does it mean when only one column in Indexes array is active?
Also this VI cannot cope with negative values due to terminals mismatch in in Range and Coerce.vi. So probably I need to make two of them for both positive and negative values.
Actually every element in the arrays from VI I attached previously corresponds to a specific point in a plane (a metal sheet). It means that if two pairs of indices are equal then the specific point is found. So, I need only one pair of indices, otherwise mismatch occurs.
Thanks for your help!
Attachments:
Search Indices_1.vi ‏10 KB

Similar Messages

  • Searching Squares in 2D Array

    Hi, I am new to Java and I am currently trying to learn how to do multiple row searching in 2D array..
    I have an input of character array that starts like this.
    private static final char[][] bigSquare =     {
              { 'F', 'G', '3', '4'},
              { 'F', 'G', 'C', 'D'},
              { 'E', 'F', 'G', 'H'},
              { 'E', 'F', 'G', 'H'}};
    private static final char[][] smallSquare ={
              { 'F', 'G'},
              { 'F', 'G'}};I am suppose to find the number of occurence of the small squares in the bigSquare in this 2D character array.. but I have no idea how to start,
    I currently have this code
    //b is the big square, r is the small square, bSize is the width of the big square, rSize is the width of the small square
                 public static int checkOccurence(char[][] b, char[][] r, int bSize, int rSize) {
              int n = 0; //to return
              // TODO Search for square occurrences..
              for (int i = 0; i < b[0].length; i++) {
                   for (int j = 0; j < b.length; j++) {
                   System.out.println();
              return n;
         }The above example should return 2
    Can someone point me in the right direction? :(
    Edited by: 873045 on Jul 17, 2011 2:01 PM

    mGx-Alander wrote:
    Thanks Winston and Ram
    I got it :DWell done. And isn't it much more satisfying when you get there by yourself?
    Now to the critique - and don't worry, these are all things that you'll learn as you go on.
    First: I don't like those 'bS' and 'rS' names (what is rS?). The 'bigSquare' and 'smallSquare' that you had originally were much better, and there's nothing to stop you using them in your checkOccurrence() method too. Just rename the parameters.
    Second, your code assumes that your matrices are squares. In this case, you'll get the right answer (if the code is right; and at first glance it appears to be), but it makes the solution "brittle". What if the next assignment is to find a small rectangle inside a big one? Wouldn't it be nice to reuse the same code?
    Third: I rather like your idea of banging the entire bigSquare into a 'line' of Locations - quite clever - but I suspect you can go even further. Have a think about it.
    Fourth: You've got quite a lot of 'loops inside loops', which usually means that you haven't broken the problem down enough, and makes the code quite hard to read.
    Now that you've got some working code, I'll give you my "pseudo description" of the solution:set 'numberFound' to 0.
    for each cell in 'bigSquare', starting from the top-left:
       if its value matches the top-left corner of 'smallSquare'
          compare the 'internal square' starting here with the contents of 'smallSquare'.
          if the contents match
             add 1 to 'numberFound'.
    end-for-each.Obviously, it's not detailed enough - the "compare the 'internal square'" line needs some fleshing out - but basically it describes the major steps.
    So what about "compare the internal square"?
    Get another piece of paper and describe how that works (which is basically all the inner stuff starting from "for (int r = 0; r < rS.length; r++) {...").
    Now, most importantly, when you do your translation into Java, make all your pieces of paper separate methods. It's not a hard and fast rule; but it's not a bad one to start out with.
    I think I might define the method something like:public static boolean completeMatch(char[][] bigSquare,
       int atRow, int atColumn, char[][] smallSquare) {...and then your outer loop might look something like:for (int i = 0; i < loc.length; i++) {
       int r = loc.getRow();
    int c = loc[i].getCol();
    boolean found = false;
    if (bS[r][c] == rS[0][0])
    found = completeMatch(bS, r, c, rS);
    if (found)
    ++n;
    }a bit neater, don't you think?
    There are many other ways to do it (for example, you could make the 'top left corner' check the first thing in your 'completeMatch()' method; I probably would), but the main idea is: break things down.
    If you find yourself writing reams of code in the same method (my usual rule of thumb is about a screenfull): Stop; and think about how you could break it up.
    HIH
    Winston

  • Vector Array out of range error

    Hiya, I've run into a strange Vector out of range error when trying to splice a Vector array. The idea is to cut off the Vector array after a certain point....
    var vec:Vector.<int> = new Vector.<int>();
    vec.push(1);
    vec.push(2);
    vec.push(3);
    vec.push(4);
    vec.push(5);
    vec.splice(3,vec.length); // output RangeError: Error #1125: The index 5 is out of range 5.
    The strange thing is that it works perfectly, if I change the Vector to a regular array like:
    var vec:Vector.<int> = new Vector.<int>();    to    var vec:Array.<int> = new Array();
    Any ideas what am i doing wrong ?
    Thanks, Martin

    I don't know why it don't throw error in Array, but seccond parameter in splice method is deletecount, so you try to delete all elements start from 3 (from element 3 to element 8, but you don't have 8 elements).
    vec.splice(3,vec.length - 3);

  • Function to search a Strings within Arrays

    Hi all,
    trying to make a soccer tournement management system primarily using Java with NetBeans.
    Having trouble finding info on a how to function. Would like to search either
    - last name
    - first name
    - by suburb
    - player jersey number. (search int, instead of string [just numbers])
    all these teams are going to pre-written into Arrays, so are just searching the array.
    so i guess thats 4 different functions, but similar. Sorry if this is sounding a little to C instead of Java, still a newbi.
    Cheers all

    Here's a Collections tutorial.
    http://java.sun.com/docs/books/tutorial/collections/
    The simplest thing to do would be to methods like: public List getByLastName(String lastName) which would then iterate over each player and add a player to the List that's being returned if his name matches.
    The performance won't be great, but if you only have a few dozen or few hundred players, it might be okay, depending on how often it's being called.
    For something that's a little cleaner design and probably would perform better, you'd need a more complex data structure than you can probably grasp at this point. (Not trying to be insulting--just pointing out that you seem to be new to this, and that kind of data structure is not an intro-level thing.)
    Also, have you thought about how you're going to store the data? Will it be in files, or are you just going to hardcode it all right into the program?

  • Search help on a field with value range

    Hi,
    I have a z-table. One of its fields has a z-data element with z-domain which has a value range. I have a requirement to add a search help on selection screen field which is parameter for mentioned field of my z-table. How can I do that?
    Tnx in advance,
    Nati

    Hi,
    Where you want to add the search help, i mean in report or in screen painter.
    In Screen painter, you can take the reference of Z-Data Element by Dictionary option in Screen layout.
    If it is report, you can use F4 function module(F4IF_INT_TABLE_VALUE_REQUES) or can creat the elementary search help in DDIC and give it as MATCHCODE OBJECT in PARAMETER statement.
    Regards,
    Chandu

  • Searching by a single date or date range.

    I would like to be able to search by a single date, @StartDate, or by a date range , between @StartDate and @EndDate. I am having a hard time with the logic on this for a report in SSRS.

    Hi MJohnson629,
    According to your description, you want to use @StartDate and @Enddate parameters to filter report, right?
    In your scenario, you could create two report parameters (@StartDate and @Enddate), then specify a filter as date field between @StartDate and @Enddate in main dataset. Please refer to steps below:
    1. Create two parameters, select the Date/Time for Data type. You could specify the date field as available values or not give available values.
    2. In main dataset, specify the filter like below:
    3. Preview the report, select values for parameters.
    If you have any question, please feel free to ask.
    Best regards,
    Qiuyun Yu
    Qiuyun Yu
    TechNet Community Support

  • Searching two dimensional string arrays

    Hello, I'm very new to Java. I would like some advice on the code below. What I'm trying to do is: I want the user to enter a 9 digit number which is already stored in an two dimensional array. The array is to be searched and the 9 digit number and corresponding name is to be printed and stored for future reference. Something is wrong with my array checking. If I enter the nine digit number, the program errors and asks me again for the number. If I enter 0-4, I receive an output. I just don't know how to compare string array values. Could someone please help me with this?
    import java.io.*;
    import java.util.*;
    public class SocialSn2
         public static void main(String args[]) throws Exception
              boolean validSSAN = false;
              Ssn(validSSAN);
              if (validSSAN)
                   //Ssn(false);//write the code here to continue processing
         }//end main
         public static void Ssn(boolean Validated)
              String[][] employees =
                   {{"333333333", "Jeff"},
                   {"222222222", "Keith"},
                   {"444444444", "Sally"},
                   {"555555555", "Kaylen"},
                   {"111111111", "Sheriden"}     };
              boolean found = false;
              while (!found)
                   System.out.println("Enter the employee's Social Security number.");
                   BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
                   try
                        String line = in.readLine();
                        int input = Integer.parseInt(line); //added
                        found = false;
                        for(int j = 0; j < 5; j++)
                        if(input >= 0 && input <= employees.length)
                             //if(employees[j][0].equals(input))
                                  //System.out.println(employees[input][0] + employees[input][1]);
                                  found = true;
                             System.out.println(employees[input][0] + " " + employees[input][1]);
                   catch (Exception exc)
                        System.out.println("error");
                        found = false;
              Validated = found;
         }//end Ssn
    }//end class

    There seems to be some problem with your loop for checking those values
    if you had used System.err.println() in your catch block you would see that you were getting an ArrayIndexOutOfBoundsException
    The following works for me.
    import java.io.*;
    import java.util.*;
    public class SocialSn2
    public static void main(String args[]) throws Exception
    boolean validSSAN = false;
    Ssn(validSSAN);
    if (validSSAN)
    //Ssn(false);//write the code here to continue processing
    }//end main
    public static void Ssn(boolean Validated)
    String[][] employees =
    {{"333333333", "Jeff"},
    {"222222222", "Keith"},
    {"444444444", "Sally"},
    {"555555555", "Kaylen"},
    {"111111111", "Sheriden"} };
    boolean found = false;
    System.out.println(employees.length);
    System.out.println(employees[0].length);
    while (!found)
    System.out.println("Enter the employee's Social Security number.");
    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
    try
    String line = in.readLine();
    //int input = Integer.parseInt(line); //added
    found = false;
    for (int i=0; i< employees.length;i++)
         if(employees[0].equals(line))
         System.out.println(employees[i][0]+" "+employees[i][1]);
         found = true;
    catch (Exception exc)
    System.err.println(exc);
    found = false;
    Validated = found;
    }//end Ssn
    }//end class

  • How to Search BPM Processes for a Given Date Range through a VC Report

    Hi All,
    We have a VC component build to view the BPM process information. Here we are supposed to provide a Date range option for searching the processes. But the Range search is not working.
    I tried in below ways.
    1. On Action Submit, I set the Occurance_D value as "=DSTR(@DATE_FROM,"M/D/YY")&" - "&DSTR(DADD(@DATE_TO,1,"D"),"M/D/YY")" it is working only if there are processes existing either on DATE_FROM or on DATE_TO, otherwise its not working.
    Like, I have 5 processes triggered on Sep-5-2011, then if i give the Date Range as 9/5/11 - 9/11/11  or 9/1/11 - 9/5/11  it is working. But if I give 9/1/11 - 9/11/11 it is not working.
    I tried this way as well.
    =DSTR(@DATE_FROM,"M/D/YY")&" : "&DSTR(DADD(@DATE_TO,1,"D"),"M/D/YY") . Even this is not working.
    Can some one please help.
    Regards,
    SrinivaS

    Dear SrinivaS,
    The main things you need to consider are:
    - store your date value from the UI in a store
    - the store gets used to submit a filter string in format (MM/DD/YY) to
    BI_START_TIME_D.
    If you follow http://help.sap.com/saphelp_nw72/helpdata/en/81/541300d147
    41b39057c8ab3be61f7a/frameset.htm
    you find that the process data source can be filtered in format  "9/9/11
    - 9/12/11" for field BI_START_TIME_D and BI_END_TIME_D.
    The trick is now at submission time to concatenate the strings
    accordingly and submit to BI_START_TIME_D. Use the following dynamic
    expression
    =DSTR(store@START_DATE_FROM,"MM/DD/YY")&" - "
    &DSTR(store@START_DATE_TO,"MM/DD/YY")
    to format the string during submission. I was able to verify this on my
    machine. I hope that also your locale settings work with this
    implementation.
    Find attached a link to a small sample application [(test_date.zip) |please find attached a small sample application (test_date.zip) which]which shows you the proper usage of a date picker in conjunction with the
    process data source. Please import the zip file into VC and deploy it.
    Best regards,
    Ralf.

  • How to create a picture indicator from an array of 32-bit integers

    My problem is simple. I have an array of signed 32-bit integers that represents image information. I want to display that information in a picture indicator on the front panel of my VI, but none of the picture indicators accept the array. What conversions or picture control do I need to use?
    thanks!

    Try Draw Unflattened Pixmap.vi.
    Lynn

  • Return indices of sorted array

    I'd like to sort an array and be able to use the sorted indices to sort another array (easy in Matlab).
    I see there's an OpenG vi, but I was wondering if it can be done in standard LabVIEW.
    Thanks!

    Never mind ... I ended out writing my own vi to sort returning index and then sort using index (attached).
    Attachments:
    SortAndIndex.vi ‏12 KB
    SortByIndex.vi ‏11 KB

  • Search results in 2D array format

    Hi,
    I need to display the search results in HTML TABLE (obtained as bean objects from Arraylist) using a JSP. But the display format should be like below:
    searchResult_1 searchResult_2 searchResult_3
    searchResult_4 searchResult_5 searchResult_6
    Next set of results should be on next page and so on.......
    Can someone please help/suggest as how to accomplish this:
    1: Display the results across first (say upto 3), and then down
    2. pagination
    Thanks
    Message was edited by:
    singalg
    Message was edited by:
    singalg

    You first need to learn HTML tables. That should be easy enough. Then you can search Google for pagination code, which I'm sure there's a few million examples out there.

  • VA05 Performance issues & search indices

    All,
    We have a performance issue with transaction VA05 (list of sales orders). On searching SAP notes as well as all forums, no information relevant to our case could be found, so posting it here.
    When we run VA05 with selection criteria - customer purchase order number (BSTKD), sales area (VKORG, VTWEG, SPART), the search takes about 5 min or more and times out for some selections. However when I terminate the transaction and rerun it by leaving VTWEG and SPART blank (or VTWEG alone blank), the search is surprisingly quicker - about 5 sec.
    An input from our ABAP expert is that ideally VBKD data (based on BSTKD) should be read first and this data should be further filtered after reading VBAK; however transaction VA05 reads both tables independently, i.e. fetches handful records from VBKD for matching BSTKD and several thousands of records from VBAK (matching VKORG, VTWEG, SPART) and then does an 'intersection'. So it is this VBAK table that seems to cause the performance issue.
    So we updated statistics of both tables, changed the estimate % from 1 to 10 still there is no improvement. What I don't understand is when only BSTKD and VKORG (VKORG is mandatory) are chosen, the search is much quicker though it is the same two tables relevant for search in both cases.  It couldn't have always been this way because this dip in performance is a phenomenon identified only recently.
    Can someone please throw some light on this or advise how performance can be improved with complete sales area in selection? (sales area is required in selection as VA05 is used by different businesses)
    Thanks & Regards,
    KC
    SAP SD Analyst

    >
    Krishna Chandika wrote:
    > All,
    > We have a performance issue with transaction VA05 (list of sales orders). On searching SAP notes as well as all forums, no information relevant to our case could be found, so posting it here.
    What about note 878680?
    If this doesn't help, you should send it to SAP. How can the forum help??
    Rob

  • Search numbers from an array

    Hai
         Pls help me how to do this,
    My read CAN data is like this
           First frame -10 11 58 05 52 35 F1 52
    Conse. frame 1 -21 04 E8 52 10 E8 56 11
    Conse. frame 2 -22 E4 56 12 E4 62 11 E4
     i want to extract the red coloured numbers from the array.
    Thanks
    sk
    I am using LabVIEW 7.1 & NI PCMCIA CAN card
    Attachments:
    tttttt.vi ‏82 KB

    If instead you want to extract certain data bytes from each message, you should use the 'Index Array' function from the Array palette.
    This will extract individual elements from the array as specified by the connected Index inputs. The image below shows the setup needed to get the elements for your First Frame.
    Ed
    Message Edited by Ed Dickens on 01-18-2007 07:57 AM
    Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
    Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
    Attachments:
    Index Array.gif ‏13 KB

  • What is happening when the "search indicator" in the tab rotates counterclockwise (gray) rather than clockwise (green)?

    no additional info required?

    That indicates Firefox is trying to connect to the web site but hasn't found it yet.

  • EasyDMS - search by date range for characteristics of type date

    Hi Folks,
    I have a characteristic of type date in the additional data of a DMS document. If I enter the date (for example validity date) as 08/31/2009 and search using cv04n and give a date range for the characteristic (i.e. 01/01/2009 - 12/31/2009), the search result will bring up the document.
    However, I cannot do this from the EasyDMS find function. I need to specify an exact date. This is not very helpful for user who need to find documents with a validity date between 01/01/2009 - 12/31/2009 for example. Is there a way users can search for date range in EasyDMS find function?
    Thanks,
    Lashan

    To search a date range with EasyDMS Client you have to set the registry key
    \HKEY_CURRENT_USER\Software\SAP\EasyDms\Generel\DateSearchPick to Value 0
    Then you can use the input field like in SAP-Gui. (01.01.2009-31.01.2009)
    If you set the value to 1 or the key is not defined you can only search for one specified date.
    If you don't find this key on your PC create it as dword.
    Maybe you must restart you PC for takeing effect.
    Hope this will help you.
    Regards Wolfgang

Maybe you are looking for

  • HP Laserjet 1200 and Driver Updates

    On the "Download Drivers and Software" support page for the HP Laserjet 1200 printer, there is an option, "Automatically check to see if your driver needs updating". A machine that I am supporting is having a MS Word collating issue (sometimes works,

  • In a FORM search box that i have data saved, how can I go and see what is saved and edit it?

    In a FORM search box that i have data saved, how can I go and see what is saved and edit it? Sometimes when I'm doing maintenance it all gets deleted and I would like to be able to see what I have saved before it gets deleted.

  • Changing colors in templates

    Hello. I am sure this is soooo easy and soooo obvious, but I am not seeing it. When using the Special Occasion template, there are some light blue boxes in the design. How can I change the color? Thanks.

  • Captivate 5 and Windows 7

    I need to purchase a new computer and wanted to check if the known install issues with Windows 7 have been fixed? Thanks

  • TryParse not passing correct values?

    All, I'm trying to parse text box input to an integer.  Then based on the value of that integer a sub will set values for various other variables (integers).  Then the integers that are obtained from the sub are passed to a sb.appendline. I am doing