Searching for Y value in an array of point

Hopefully, someone can enlighten me ?
I have an array of point
int[] depth = {25, 30, 35, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190};
int[] minutes = {595, 405, 310, 200, 100, 60, 50, 40, 30, 25, 20, 15, 10, 10, 5, 5, 5, 5, 5};
Point[] points = new Point[depth.length];
for(int i = 0; i < points.length; i++)
        points[i] = new Point(depth, minutes[i]);
JTextField tfXvalue = new JTextField();
String getXvalue = tfdepth.getText();
Say the input of getXvalue is 40. Then I do all of the necessary conversions from string to double etc...
I need to tell the program to look in the array, and return the Y value where X=40.
I haven't the slightest idea where to start. !!!!
Would someone please point me in the right direction ?

If the user enters 41 which is not in the array. how
can i say since 41 is not in the array, go to the
next number which will be 50 in this case ?
Help from anyone ?Sort the point array by x values,
If you find the x value, return the y value,
If you pass the x value without finding it, return the next y value.
How to return the fact that the specified value wasn't found depends on your design.

Similar Messages

  • How to search for a value in an iterator in Jdev 10.1.2?

    Hi!
    I need to search an iterator named "PermitYrIterator1" for a year value (e.g. 2009) that is stored in bindings.Yr in my jsp. How do I do this in my jsp's DataForwardAction Code) in Jdev 10.1.2?
    I need this in my "Create page." I need to search for this value because I want to check if I should re-execute the "PermitYrIterator1" so that it shows the newly added year in bindings.Yr or not. If bindings.Yr is found in the iterator then I do not need to re-execute the iterator. But if the newly entered year cannot be found then I need to re-execute the iterator.
    I hope you can help me immediately! Thanks!

    Hi,
    Anyone can help me on this please?

  • How to search for multiple values with Bex Prompts

    Hi,
    I would like to know  if it is possible to search for multiple values at the same time with Bex Prompts instead of searching one value at a time (please see the screen shot below). I searched the forum couldn't find any relevant answers. please let me know  how  to achieve?
    Thanks,
    Charvi.

    Hi Charvi,
    You can use wild card search to ensure you get multiple similar values listed as search output.use * for multiple characters and ? for single character.
    For Example, Ravi * would result you all employees with first name as Ravi
    You can use various search formats such as * Ravi * and * Ravi and Ra?? etc.
    Thanks
    Mallik

  • How to search for a value within a tolerance in an array?

    I am trying to search in an array for a value of say 10 plus or minus 2. In other words, I want a value of true if there is any value in the array between 8 and 12.

    canadian;
    LabVIEW includes with a VI called In Range and Coerce. You can test the value using that VI.
    I also created a VI for exactly that. You can download it from here:
    http://www.jyestudio.com/lview.shtml
    It is called Search 1D array using conditions. Let me know if it is useful. Even more efficient, you can look at the code of that VI and then extract the functionality you want for your application.
    Regards;
    Enrique
    www.vartortech.com

  • Search for Duplicates in a 2D Array

    I am working on a program that takes a user input of a job number (imported as a string).
    With that job number I need to search a .txt spreadsheet file for the job number and create a cluster of information based on the items in the same row as the job number. I originally accomplished this as shown:
    This worked very well. That is, until my data file changed. Now my data file can possibly have a duplicate item as attached. The only difference between the two rows is that the second column has a smaller value. I cannot change how I receive my data. I always need to return the row that has the larger value in the second column.
    The method I came up with is as shown:
    This method seems to be a lot less efficient than the original method since it requires that even if the job number is the first item on the list, I must step through the entire list. The file I am working with is computer generated, so it will always be sorted by job number, but we cannot guarantee whether the first or the second or the third occurance of the item is going to be the longest.
    Any thoughts on a more efficient method of handling this? I searched around and saw a posting that used variant data types to remove duplicate values from a 2D array. I tried to expand that to this application, but I wasn't able to follow the use of variants in that situation. This is the original posting I saw: http://forums.ni.com/t5/LabVIEW/Remove-Duplicate-R​ow-From-2d-Array/m-p/1211071/highlight/false#M5186​...
    Thanks,
    Michael
    Attachments:
    nchcablejobs.txt ‏49 KB

    here is one way to find all matches first and then you can add a fine search/separation if there is more than one match
    depending on the size of the sorted array it might be faster if you search for the first match and than look if the next still matches ...
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'
    Attachments:
    find all matches.vi ‏11 KB

  • How do I search for a value in a db?

    I have a mysql-db which is connected to a java-program.
    It is an applet with a JTextField and a JButton.
    When I write something in the JTextField and presses the JButton I want to search for the word in my database and return some other values.
    This works properly if I write the exact String.
    How shall I do if I want to be able to only write the beginning of the word and retrieve all values that begins with these letters?
    Instead of writing "ABC123" I would be able to write "ABC" and retrieve all values that begins with ABC.
    Any suggestions?

    Yep,
    String sql ="select * from tablename where VALUE like '"+textfield.getText()+"%'";That should do.
    HTH

  • Searching for numeric values in a text field / SQL Server

    Hi all,
    here's a problem that I've been trying to solve for several days: I try to select rows from an MS SQL Server via JDBC that contain a certain numeric value at a certain position in a long varchar field.
    I'm using queries like
    select * from table where substring(field_1, 37, 7) like '1011234';Those queries always return an empty ResultSet. If I use the same queries in WinSQL, I get correct results (several rows).
    The application code is working in principle; if I search for a text instead of a numeric value, for example select * from table where substring(field_1, 4, 5) like 'Paper'; , I get a complete ResultSet.
    I've tried many variations (= instead of like, search in the entire field (without substring but with like '%1011234%'), with or without ', and more), but that didn't change anything.
    It's also most probably not caused by the JDBC driver; I have tried JTDS first, and then the MS driver (newest versions) - no difference.
    One idea was that the sort order is not correct, tried some COLLATE settings, but that didn't help so far. In this context I'd like to know how to determine the collation sequence of a certain column.
    Another thing I tried was using CAST, for example SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST('1011234' as bigint); or SELECT * FROM table WHERE CAST(SUBSTRING(field_1, 37, 7) as bigint) = CAST(1011234 as bigint);, but that didn't help either.
    Some facts:
    Server: Microsoft SQL Server, version 09.00.2047
    Driver in WinSQL: SQLSRV32.DLL, version 03.85.1117
    JDBC-Driver:
    - JTDS, version 1.2
    - Microsoft SQL Server 2005 JDBC Driver, Version 1.2
    JVM: jre1.5.0_11
    I didn't find anything on Google, or in this forum, or other forums. I really hope someone here can help me. Thanks in advance!
    Best regards,
    Uica

    Your note suggests to me that this is a coding problem, not a JDBC or SQL problem unless you are hitting a bug in the SQL Server JDBC driver. Others may have ideas from what you have written, but I think it would be helpful to see the actual code that you are executing that does not bring back the results that you are expecting (don't forgot to use code tags to format your code correctly).
    It might also be helpful to execute a query (from within your Java code) to ensure that you are connecting to the right database, accessing the correct table and that your substring is using the correct offset. The query would look something like this (and then of course display the list of results):
    SELECT substring(field_1, 37, 7) from table

  • Wildcard search for numeric values using select ?

    Hi,
    I want do wildcard search for numeric fields of the table.
    For charcter/string i have used - select * from XX_TABLE where param1 like 'SS%'. But this query doesnt work when para1 is numeric. Please let me know first whether this is possible ? if yes how to achieve it ?
    Thanks in advance,
    Shrinivas

    Hi Jack,
    The numeric field is of  8 digits, so when i give search critera as '66', it should return values 66000000, 660000, 6600 etc. so i was not able to give between some range. I also tried storing all these values in internal table and the segregate the values it contains '66*'. This worked well but requires lot of coding effort.Please suggest if you guys have any better method ?
    Thanks,
    Shrinivas

  • Search for multiple values

    Hello,
    I would like to search a table and find all values for each student that have a certain key word in the heading of a column and use all of the values found to calculate different averages.  Is this even possible?  Can i do a vlookup, or something like that, to search out many different values?
    https://www.dropbox.com/s/kiqwl2qg50u2ubz/6th%20Grade%20Math-2012-11-08%20%281%2 9.numbers
    Thanks!
    -Josh

    Josh,
    SUMIF will do the work for you, but the searching for a particular string in the title will have to be done in an auxiliary row, not in the SUMIF expressions.
    So, add a row above the row with the score titles; a new Row 1. In C1 write:
    =IFERROR(FIND("N2", C2), "")
    Fill Rignt
    Now you have a key. Every column with "N2" anywhere in it's row 2 cell will have a "1" in row 1.  You can use SUMIF, COUNTIF or AVERAGEIF to find those stats on a per-student basis. Your example file has only 2 columns with N2 in the score description, so the stats will be rather trivial for that particular set.
    There's another way you can use this key. You can create a second table that mirrors the first table, but has null strings in all columns without the key and the true values for all columns where the key is "1". That would look like this...
    This all seems a bit trivial, so I may be missing the point. It seems that you could just ignore the nonrelevant columns rather than go to the trouble of flagging them and filtering them out of the final table.
    Jerry

  • Search for a value in the database

    Hi Guys,
    Don’t know if I am being paranoid here. But is there a way to search for a particular value in the entire set of tables in oracle.
    For example I am having a part number called ‘AF2425-B12’ in my inventory table. Is there a way to find out all the tables which contains the value ‘AF2425-B12’ in any of the columns in my database?
    Many Thanks,
    Napster

    Hope this link ll help you,
      https://forums.oracle.com/thread/2572717?start=0&tstart=0

  • Search for specific values (no *) in RSUSR070

    I want to find all activity groups that contain a specific entry for authorization object P_ORGIN, Personnel Area field.  I want to search for FL02 for example, but if I type FL02 in the selection field, I will also get any activity group that contains * as the value for Personnel Area.  I tried putting FL02 in single quotes but that did not work either.
    Any ideas?
    Thanks,
    Cindy

    Alex69 wrote:
    Thanks for the answer…
    I thought maybe I'm doing something wrong or this is because i excluded the Time Machine volume from spotlight, but ok, not my fault, but an apple "feature"
    I could search for specific E-mails using a finder search and then switch into Time Machine, but since Mail is called a Time-Machine-Aware Application I felt there should be a direct way to do this in Mail…
    Yes, there "should be a direct way to do this."
    The approach you describe above will work for email that still currently resides on your Mac, for example an email that has been "Replied" back and forth and you wish to retrieve an earlier version of the conversation. Or perhaps a "Draft" email that has undergone changes over time, of which you need to retrieve an earlier version. In these cases using Time Machine is relatively straight forward.
    My problem with Mail/Time Machine is with a specific email that has since been deleted. Unless you know exactly what mailbox that email had been in, and at what time the email had existed, then it can be like searching for a needle in a haystack. In this case the Time Machine interface needs to have a search box added to the "time travel" windows for faster retrieval of specific items, the location of which the user doesn't remember.
    I'm convinced, though, that the usability of Time Machine in such instances will improve over time. Particularly as more app become integrated with it.
    Glenn

  • Recieve a value and search for a value greater than item

    is this code correct if i wanted to recieve a single argument item and search the list for a value greater than item
    public boolean greaterFound(Comparable item)
         int index = 0;
      while (index < numItems && listItems[index].compareTo(item) != 0)
          index++;
      return ((index-1) < (index));
    }

    Okay here are all the errors piece by piece.
    public boolean greaterFound(Comparable item)
         int index = 0;Well to start with this is not an error per se. But I would just return true if I found a match and false otherwise. There may be some who think that is terrible... I disagree.
      while (index < numItems && listItems[index].compareTo(item) != 0)What is numItems?
    That if is shady.
    What you are checking for is flat out wrong.
          index++;I'd be returning true here
    return ((index-1) < (index));This is just nonsense. As it stands will always return true and invalidates the rest of your code.

  • How do I search for a value in an Excel sheet using ActixeX

    I am already accessing my excel sheets however I need to be able to search the sheet for a certain value and return the row/cell location. Is there an activeX control that can do this?

    You will need a reference to the range to search. This can be the entire sheet if you wish. Just wire that to the method node Find. Here you can specify all of the typical search options. Wire your string or number into the What input. For the what to LOOKAT value, use -4163 for Value and -4123 for formulas.
    The reference returned is the range of the found value. You can wire it into the property node Row and Column to get the location.
    Michael Munroe
    www.abcdef.biz
    Michael Munroe, ABCDEF
    Certified LabVIEW Developer, MCP
    Find and fix bad VI Properties with Property Inspector

  • How to search for specific match from an array?

    Hi Mike,
    Thanks for the reply.
    I am reading a position of switches whether ON/OFF. It is nothing but the digital inputs status from the field. I am Indexing that array, and connect it to the LED indicators to show the relevant status. Also I want to raise an alarm  once, for the ON switches.  By using Search 1D array, I got the first TRUE match index from the array. But if I want to know all the occurrences of ON condition (TRUE from an array of booleans) from an array of switches. How to do that?
    Hope this clarifies.
    Thanks
    Kousy

    I almost missed this message because you started a new thread.
    In any case, the code altenbach posted will give you an array of the indexes that are set to true. So it sounds like that is at least part of what you want. The alarm you mention, is that one "master" alarm if any of them are true, or is it a separate alarm for each bit?
    If it is one "master" alarm for all of them the logic menu has a function for ORing all the elements in a boolean array. Also when you say "alarm" what is the nature of this alarm? A dialog box? a flashing light (real or on the applications's front panel)? message in a status display?
    The attached code shows one possible direction by adding onto altenbachs code the ability to accumulate a single error message based on the states of individual bits. (BTW: The other alternative that you might see would be to pass the array into a loop and use a case to append a message of the bit is true. The advantage of the one in the combined VI is that the loop only iterates for the number of true bits +1. Where as the other approach would have to look at all the bits one at a time.)
    In a sense this is why I asked for clarification because there are a lot of things you can do when parsing an array like this.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    TRUEadditions.vi ‏31 KB

  • How do I search for common values across multiple columns?

    I am coordinating a schedule with 5 people across hundreds of dates, and have columns A-E filled with many rows of dates. How can I make a new column that displays all the dates (values) that each person (column) has in common with all the others?
    Is there a simple formula for this?
    thanks!

    Scarampella,
    A second table can be used to find your matching dates.
    Here's an example:
    The formula in Matching Dates is:
    =IF(ISERROR(MATCH(A,Table 1 :: A, 0)+MATCH(A,Table 1 :: B, 0)+MATCH(A,Table 1 :: C, 0)+MATCH(A,Table 1 :: D, 0)+MATCH(A,Table 1 :: E, 0)), "", A)
    Basically, I look for matches in each person's list of dates, and if any fail to produce a match with the date being examined, the result is a miss, and if all match, it's a hit. You can sort the result to get a short list of matches without spaces.
    Regards,
    Jerry

Maybe you are looking for

  • Can i set up a spare box in my bedroom?

    Im sorry if this has been asked a million times but ive had a look at a few posts but theyre not specific. Also, im not familiar with too much tech talk. The new house had already black box (which we watch freeview on now) and a hub but obviously the

  • Slow iMac, kernel_task using 1GB memory

    My iMac has been running slower and slower over the past year or so.  The problem seems to come and go, but I have been noticing increasing tendency for applications to hang, or to get stuck for minutes with spinning beach balls.  I've been carrying

  • Does Oracle support this........

    Hi I want to select values in a object types in a table over the database link. like select name from [email protected] where name is of type varray(3) of varchar2(100) in the country table and db.com is database link. It is giving me error ORA-22804

  • Texts from Activity to Subsequent Transactions

    Subsequent transaction can either be a Lead  or Opportunity or Activity itself. Activity and Lead transactions have different Text Det Procedures with different Text Types. Requirement is Text should get transferred from one Text Type  of Activity to

  • Manage Delegation/Secondary Cals for Windows Clients

    Hi there, We're deploying Leopard Server in a mixed environment. Obviously, iCal works like a dream for our Mac users, but I'm running into a few stumbling blocks for our Windows and Linux users accessing the system VIA Sunbird. First, is there any w