If I have floating values such as 6.3, 6.7, 6.9, 7.1, 7.2 how do I write a case statement to handle that

How do I write a case statement If I want a case for x < 1.5;   a case for 1.5 <= x <= 3.7;  case for  3.7 < x < 7.2.....etc.   My input is a floating number.
Thank you.
Solved!
Go to Solution.

smercurio_fc wrote:
Nice method with the Threshold function. I was not aware of the limitation with -Inf. Odd.
Actually, my code operates correctly as long as the first element is smaller than all other elements in the array. We don't need any special handling.
Maybe NaN is not a bug if the array starts with -Inf, because the interpolated index for any number between the second element and -inf will be infinitely close to 1, thus a result of zero can never be obtained (try a first element of -1e50 and you'll always get 1 unless you go to very huge negative numbers).
The way threshold array is defined, the behavior should be obvious, the problem is assigning a fractional index.
It is unexpected that an input equal to the second element also results in NaN. That might be a bug. (see image).
I probably won't post an idea, maybe a bug report after some more thinking...
LabVIEW Champion . Do more with less code and in less time .
Attachments:
IdeaThresholdArray.png ‏19 KB

Similar Messages

  • I accidentally combined all of my photos on iphoto to be one event. i have it the way i want it saved on my external harddrive from time machine. how do i make my computer go back to that

    i accidentally combined all of my photos on iphoto to be one event. i have it the way i want it saved on my external harddrive from time machine. how do i make my computer go back to that

    Open Time Machine to the date that you know the iPhoto Library is in the format you want and select and Restore it.
    http://pondini.org/TM/15.html
    Ciao.

  • I updated my IPAD 's IOS last night ...I have NEVER used a passcode for my IPAD & it is asking for it...How am I supposed to put in the passcode that I NEVER used? now I cannot even use my IPAD...HELP!!

    I updated my Ipad( ios 7.1) & now it is asking for my PASSCODE ...I NEVER used a PASSCODE ,so now I am unable to use my IPAD because I DO NOT or NEVER have used a passcode ..my IPAD is useless ..I am locked out because I have NO passcode to use!  HELP!!!

    I have seen other users talk about this and make the same claim. Unfortunately, even if you didn't set a passcode, and the iPad is insisting that you did, unless you can successfully guess what the passcode is, you still have to follow these instructions and use one of the methods in here in order to restore your iPad which will then unlock it.
    iOS: Forgotten passcode or device disabled after entering ...

  • How can i write the floats value in Unitronics vision230 plc using modbus Ethernet

           How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I  read and write  the 32 bit register,  for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I  read and write  the 32 bit register.
    Narendra.
    Solved!
    Go to Solution.

     Thanks Amit for your solution but i can not use the string to write the value because  MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have  no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
    Narendra
    Message Edited by Artemistech on 01-30-2009 11:06 PM

  • Erstellungs Datum must have some value. = IT HAS!

    hi.
    i created a form with a report with the wizard. but very strange: when i try to insert a new value into a form it tells me
    Erstellungs Datum must have some value.
    on 2 input fields, but there IS an appropriate value in it, and in other required fields the validation works! no idea what could be wrong there, because i did all with a wizard and the values are correct!
    thanks for help.

    Joshua,
    I assume the message "Erstellungs Datum must have some value." comes from a validation you created. Can you tell us how this validation is defined?
    Sergio

  • Problem to identify values in a case statement.

    Hi Friends,
    Total number of records in my report should be divided by 5 and to be alloted into 5 grades in Grade column.
    This is what I have done so far in my report with following layout.
    S.No - Col A - Col B - Col C - Grade ( Colums A,B,C will be hidden in Report)
    *****Column C will have only 5 values at max ( 0.0, 0.2, 0.4, 0.6, 0.8).The below example is for 6 records in a report.The same will be applied for 7,8,9,10 records.
    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))
    Now In Grade coulum I want to use this column C to Grade the records with case statements in it.
    I am trying to use the following case statement for Grade Coulmn
    Case
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.0 then .........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.2 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.4 then .............
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.6 then ........
    when (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0)) = 0.8 then .....
    end
    Case statement works gud for 0.0 but not for other 4 values.
    It is unable to identify other 4values.
    Please tell me, how can I make case statement work for all values in above scenario.
    Thanks in Advance,
    Varsha.
    Edited by: Varsha on Nov 28, 2010 6:23 PM

    In column A: MAX(cast(RCOUNT(1) AS DOUBLE))/5 ( Ex : 6/5 = 1.2)
    In Column B: Truncate(MAX(cast (RCOUNT(1) as double)/5), 0) ( Ex : 6/5 = 1.0)
    In Column C: Col A- Col B ( EX:1.2 - 1.0 =0.2)
    (MAX(cast(RCOUNT(1) AS DOUBLE))/5 - Truncate(MAX(cast (RCOUNT(1) as double)/5), 0))Change the formula a bit by adding the by dim value for the MAX column.
    Column A: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5
    Column B: Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    Column C: MAX(cast(RCOUNT(1) AS DOUBLE) by DimTable.Column)/5 - Truncate(MAX(cast (RCOUNT(1) as double) by DimTable.Column)/5, 0)
    now write a case statement on top column c, based on your logic every 5th record will have a value 0.0
    Note: Dimtable.column is the table.column for which the row count is taken.
    Thanks,
    Vino

  • I have managed to lock the landscape orientation on my iphone 3 - any ideas as to how I unlock it please?

    I have managed to  lock the landscape orientation on my iphone 3 - any ideas as to how I unlock it please?

    Im not aware that you can lock your screen in landscape so I'm assuming you have locked it in portrait and want to allow it to ne seen landscape, therefore double click the Home button, swipe the icons to the right, you will see an icon with a circle-arrow. That is your screen orientation lock.
    Assuming again you have iOS5 have a look at the following for more help, page 21
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • Union two tables with diffrent count of fields with null and float value

    Hello,
    i want to union two tables, first one with 3 fields and second one with 4 fields (diffrent count of fields).
    I can add null value at end of first select but it does not work with float values in second table. Value form second table is convert to integer.
    For example:
    select null v1 from sessions
    union
    select 0.05 v1 from sessions
    result is set of null and 0 value.
    As workaround i can type:
    select null+0.0 v1 from sessions
    union
    select 0.05 v1 from sessions
    or simple change select's order.
    Is any better/proper way to do this? Can I somehow set float field type in first select?
    Best regards,
    Lukasz.
    WIN XP, MAXDB 7.6.03

    Hi Lukasz,
    in a UNION statement the first statement defines the structure (number, names and types of fields) of the resultset.
    Therefore you have to define a FLOAT field in the first SELECT statement in order to avoid conversion to VARCHAR.
    Be aware that NULL and 0.0 are not the same thus NULL+0.0 does not equal NULL.
    In fact NULL cannot equal to any number or character value at all.
    BTW: you may want to use UNION ALL to avoid the search and removal of duplicates - looks like your datasets won't contain duplicates anyhow...
    Regards,
    Lars

  • Name and Address operator's packge do not have any values

    Hi All,
    I am using the Name and Address operator, but I do not have/want the 3rd party vendor's connector/tool/data library to work with my OWB.
    I developed the map and deployed that map into my target.
    Package got generated of name NAME_ADDRESS
    In this package the entry point is the MAIN function, in the main function taking one parameter p_env.
    When I execute the Package from SQL*Plus I am getting the value of p_env, which is wrong, p_env can not be NULL/0 at any case.
    All I want is, how to pass/populate the value into p_env parameter, there will be more than one value into that parameter, param_value varchar2(30)and param_name varchar2(4000).
    But I know nothing about what are the values may be in , when I execute the package...
    ALSO I AM ATTACHING SOME MORE DETAILS....
    create or replace package
    FUNCTION Main(p_env IN WB_RT_MAPAUDIT.WB_RT_NAME_VALUES) RETURN NUMBER IS
    end package
    In this main function, the p_env is getting Initialize, it calls the initialize
    procedure, there directly getting count on this parameter.
    my question is at what point of time these valiables get initialize and what
    are the exact details for the followings
    TYPE WB_RT_NAME_VALUE IS RECORD
    param_name varchar2(30),
    param_value varchar2(4000)
    TYPE WB_RT_NAME_VALUES IS TABLE OF
    WB_RT_NAME_VALUE
    INDEX BY BINARY_INTEGER;
    What are these two variables (param_name and param_value) implies in wb_rt_mapaudit package
    ANY HELP GREATLY APPRECIATED
    THANKS FOR YOUR TIME
    Gladson
    [email protected]

    Gladson,
    Page 8-73 of the Warehouse Builder user's guide explicitly highlights the following section:
    Note: Taking advantage of the Name and Address operator requires separate licensing and additional installation steps. Refer to the Oracle9i Warehouse Builder Installation and Configuration Guide for more information.
    The functionality that does the parsing and standardization is not part of Warehouse Builder, but part of the package that the software partner brings in. If you think about that, it actually makes sense. Would you expect Warehouse Builder to contain the code to perform this action for all countries across the globe, in all different languages and the like? The data vendors, who are the experts in the different areas, know this information.
    So, if all you want to do, is parse and standardize an address, then yes, you may be better of going directly to a partner (having said that, you may get a discount if you are a Warehouse Builder customer, but that I do not know for sure).
    However, what does Warehouse Builder add:
    - Data object design (maybe your target tables don't exist) and deployment
    - ETL design and code generation
    - Process flow creation and deployment
    - Execution management (automatic logging etc)
    - Integration with Discoverer
    - Metadata management, such as impact analysis, version management, multi language support...
    - Much, much more.
    Specific to name and address (or say data quality): if you include the name and address operator on a Warehouse Builder mapping, then you can plug in any partner library you want, and in case you find out that another partner delivers better results, then go with the other partner. At the end of the day, you abstracted the implementation from the design. That makes you much more flexible in your choice of a data vendor. Besides, you get impact analysis, lineage and lots of other metadata management features for free. On top of that, if you want to identify duplicates, perform householding and the like, then there is match and merge (which yes, is part of the tool and not a third-party implementation) in order to define the rules for matching and merging.
    Again, if you don't need any of that, then perhaps you don't want the overhead of having all this and you go directly to a data vendor.
    Hope this helps,
    Mark.

  • How to extract an integer or a float value from a String of characters

    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above String
    This is all i have so far:
    String c;
    String Array[] =new String[g]; (i used a while loop to obtain g(the nubmer of lines in the file))
    while((c=(cr.readLine()))!=null)
    Array[coun]=c;
    it would be reallllllllllllllllllllllllllllllllllllllly easy if there was a predefined method to extract numeric values from a string in java..
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:50 PM
    Edited by: badmash on Feb 18, 2009 5:55 PM

    badmash wrote:
    Hi i have a problem getting to a float value within a string of characters..
    for instance the string is
    "numberItem xxxxxxxxx 700.0" (each x is a space..the forum wouldnt let me put normal spaces for some reason)
    with the space included
    how do i store 700.0 in a float variable
    remember the string is obtained from an inputfile
    so far i got the program to store the inputfile data line by line in a String array..i tried tokenizing the string to get to the the float value but since i have mulitple spaces within my string, the token method only gets "numberItem" from the above StringHuh?
    Not true.
    Anyway why not use string split, split on spaces and grab the last element (which by the format you posted would be your 700.0)
    Then there is the Float.parseFloat method.
    It is easy.
    And another thing why not use a List of Strings if you want to store each line? (And why did you post that code which doesn't really have anything to do with your problem?) Also in future please use the code formatting tags when posting code. Select the code you are posting in the message box and click the CODE button.

  • I want to buy a 5s and i have a iphone 4, i would like to know if my phone have some value in change

    Hi my name is Julia, and I want to buy a iphone 5s and i have a iphone 4, I would like to know if when i'll go to buy the 5s my phone will have some value in the change
    thanks

    In the U.S., at least, the carriers have trade in programs. There are also lots of third party sites such as Gazelle.com that will give you money for old electronics. You should be able to get a quote from one of them.
    Best of luck.

  • Rounding up of a float value

    i need some help in rounding up the float value to two places after the decimal point
    i have a value like 25.34446789 and i need to round it up like 25.34

    i tried this function but i am not getting the result
    correctly .if i am using the round () function i am
    getting a value like 55.0 when the original value is
    55.085673.
    i want to get it like 55.09. round to two places
    after the decimal point .is there any other way to do
    it ?How about doing what Chuck said you should do? Give it a try and think about what he wrote. It may actually work.

  • How to see decimal part of float value?

    How to see only value of decimal part of float value?
    For example, if I have 1.455, i need only to see .455 part.

    Read the floating point value.
    Convert that into a string.
    Use the String's substring and indexOf method to find
    the "." and then cut from there, to the end of the
    string.<sarcasm>
    Really? I'm sure pbrockway already said that but i must be mistaken.
    </sarcasm>

  • Rounding ist wrong for float value (MS SQL 2005)

    Hello
    I have a simple report with a command:
    select num = convert(float, 4.145)
    Field round over "Format Field" or ToText( num, 2) the result is 4.14  -> Wrong
    if  i use Round(num, 2)  result is 4.15 --> OK
    In CR 8.5 result is always correct
    Thx

    I know the problematic of the floating values.
    My big trouble is the inconsistency in the report!
    It can't be that the formula function Round(x,y) show another result than the integrated field-rounding function.
    Also in the formula that ToText(x, y) is different to Round(x,y).
    Following another stupid difference:
    Command.num = 4.145          Result: TRUE
    Command.num - 4.145 = 0     Result: FALSE
    Mathematical it's the same.
    CR8 was consistence, after migration we have different result on our reports!

  • Draw line with float values possible

    Hi,
    Using Canvas drawing is possible to draw line with float values.
    graphics.drawLine(int,int,int,int);
    graphics.drawLine(float,float,float,float);Thanks and regards,
    Rakesh.

    not possible
    graphics.drawLine(float,float,float,float);...there's no such method in MIDP API: [click here for javadoc of Graphics class methods|http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Graphics.html#drawLine(int,%20int,%20int,%20int)]

Maybe you are looking for

  • Buy movies on Apple TV

    Two strange things happened when I rehooked up my Apple TV. One, I was only able to buy certain movies (ie, The Wild). Secondly, when I went over to my computer hooked up to the same computer and opened Itunes (it was already open on my Mac upstairs)

  • Adapter Return Value Truncated

    I am trying to understand what is going on with an adapter return value. Why would the return value be truncated to 1 character and then the result be "null" when the actual value the script returns is shown as "SUCCESS"? The web console shows the ta

  • FCP 10.7 crashes (the whole Macbook Pro) when titles are added

    I have a very frustrating problem with FCP.  Am on Snow Leopard 10.6.8.  8GB RAM. Was running 10.0.6 but have just upgraded to 10.0.7 - problem persists.  I have one video with titles included in it, put together before Nov 28th, that plays and Share

  • Home page lacks toolbars(file..back..address)

    My comcast home page does not have toolbars (file,edit...; back..home..; address) when using Firefox. (It has them when using IE). Otherwise everything works including e-mail. == This happened == Every time Firefox opened == about a week ago

  • HT204053 what is the smtp. in my user name?

    What is the smtp in my outgoing mail server