FlexPro
HistoryBase
Ingénierie
Formation
Téléchargements
Support FlexPro
Connaissance
Communauté
À propos de nous
Références
Emplois
Contact général
Liste des revendeurs
Support FlexPro
FR
DE
EN
Porte-plaquette
Produits et solutions
Support et téléchargements
Entreprise
Magazine
Contact
Langue
MyWeisang

Paramètres du compte.

Topic

help index setting

Page d'accueil ' Communauté ' FPScript ' help index setting

Voir les messages de 3 - 1 à 3 (sur un total de 3)
  • Auteur
    Messages
  • #33491
    ralf kang
    Participant

    Dim x,i,dtr,result

    result = test2

    dtr=0.00005

    For Each Row i In ori_dataset Do

    x=ori_dataset[i-1] – ori_dataset[i]

    if x > dtr then

    result[i]=ori_dataset[i]

    end
    end
    Return result

    they say “wrong value in index operation”

    how can i do?
    :bang:

    #33493
    ralf kang
    Participant

    Dim x,i,dtr,result

    result = test2

    dtr=0.00005

    For Each Row i In ori_dataset Do

    x=ori_dataset[i-1] – ori_dataset[i]

    if x > dtr then

    result[i]=ori_dataset[i]

    end
    end
    Return result

    they say “wrong value in index operation”

    how can i do?
    :bang:

    #33492
    Bernhard Kantz
    Participant

    The problem seems to be the line

    result[i]=ori_dataset[i]

    in the If statement.

    If the result dataset (initialized with test2) is smaller in length than the ori_datensatz and you try to write at an index position not present in the result dataset an error occurs.

    One further problem maybe the first difference you form in the loop. For i = 0 the variable x gets the value of last value minus the first value. If the ori_dataset is assumed to be periodic, this would be exactly what you need, otherwise the first difference doesn’t make sense.

    The vector features of FPScript allow you to get rid of the loop. The following expression computes a datasets of the periodic differences in one go:

    Dim delta = ori_datensatz[-1] – ori_datensatz[0] : ori_datensatz[0,-2] – ori_datensatz[1,-1]

    With the aid of the FPScript functions from the Event Isolation group, you can extract the desired indices; in your case the line

    dim idx = ValuesBelowLevel(delta, dtr, EVENT_INDEX+EVENT_COMPLEMENT)

    will select all values strictly greater than dtr.
    Now use

    result[idx] = ori_datensatz[idx]

    to overwrite the selected values in the dataset result.

Voir les messages de 3 - 1 à 3 (sur un total de 3)
  • Vous devez être connecté pour répondre à ce sujet.