FlexPro
HistoryBase
Engineering
Training
Downloads
FlexPro-Support
Wissen
Community
Über Uns
Referenzen
Jobs
Allgemeiner Kontakt
Händlerverzeichnis
FlexPro-Support
DE
EN
FR
Placeholder
Produkte und Lösungen
Support und Downloads
Unternehmen
Magazin
Kontakt
Sprache
MyWeisang

Account Einstellungen

Topic

selecting positive values

Startseite ' Community ' FPScript ' selecting positive values

Anzeigen von 6-Stellen - 1 bis 6 (von insgesamt 6)
  • Autor
    Beiträge
  • #33148
    mac ye
    Teilnehmer

    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[i] < 0 Then B[i]==A[i] End End But it returns "no value" Would you please give me an example for this?

    #33153
    mac ye
    Teilnehmer

    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[i] < 0 Then
    B[i]==A[i]
    End
    End

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

    #33149
    Bernhard Kantz
    Teilnehmer

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

    Example:
    [code]
    Dim B = A
    B[ValuesBelowLevel(A, 0, EVENT_INDEX)] = 0
    [/code]
    support@weisang.com

    #33150
    mac ye
    Teilnehmer

    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!

    #33151
    Bernhard Kantz
    Teilnehmer

    You have to assign the components seperately:

    Dim B = A.Y

    support@weisang.com

    #33152
    mac ye
    Teilnehmer

    Thank you! It works!

Anzeigen von 6-Stellen - 1 bis 6 (von insgesamt 6)
  • Du musst angemeldet sein, um auf dieses Thema antworten zu können.