FlexPro Forum – Discuss Your Topic!

selecting positive values

Home > Community > FPScript > selecting positive values

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #12452
    mac yemac ye
    Member

    I got a problem in filtering positive values from a data set.

    background:
    A is a data set with pos and neg values. and I want to selet all the positive values and set all negative values to 0
    so I create a data set B with same number of colums and initial value as 0

    I wrote a script in a function like this:

    Dim i
    For i=0 To 8000 Do
    If A < 0 Then
    B==A
    End
    End

    But it returns "no value"
    Would you please give me an example for this?

    #8131
    mac yemac ye
    Member

    I got a problem in filtering positive values from a data set.

    background:
    A is a data set with pos and neg values. and I want to selet all the positive values and set all negative values to 0
    so I create a data set B with same number of colums and initial value as 0

    I wrote a script in a function like this:

    Dim i
    For i=0 To 8000 Do
    If A < 0 Then B[i]==A[i] End End But it returns "no value" Would you please give me an example for this?

    #8747
    Bernhard KantzBernhard Kantz
    Participant

    You have to use = instead of ==.
    But it’s better and faster to use the ValuesBelow-function and the index operator.

    Example:

    
    Dim B = A
    B[ValuesBelowLevel(A, 0, EVENT_INDEX)] = 0
    

    support@weisang.com

    #8748
    mac yemac ye
    Member

    hello, thank you for your reply!

    when I use the valusebelow func, it replies:

    index assignment to signals, signal serials.. are not allowed. assign the components seperately.

    So do you have any further recommendation?

    Thank you!

    #8749
    Bernhard KantzBernhard Kantz
    Participant

    You have to assign the components seperately:

    Dim B = A.Y

    support@weisang.com

    #8750
    mac yemac ye
    Member

    Thank you! It works!

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.