Accueil > Community > FPScript > Equal To Operator > Reply To: Equal To Operator

#8792
Bernhard KantzBernhard Kantz
Participant

You can do this computation much more efficiently if you use the index operator and event isolation functionality to avoid loops on individual values:

Dim idx

// setup data series of proer length
Dim Turbinendrehzahl = 0. # NumberOfRows(Vges)

// Find all positions where 1st gear was used
idx = ValuesInInterval(Gangpos, 1, 1, EVENT_INDEX)
// set all these postions to a fixed value
Turbinendrehzahl[idx] = Radwellendrehzahl / 'Gang 1'

// do the same for the 2nd gear.
idx = ValuesInInterval(Gangpos, 2, 2, EVENT_INDEX)
Turbinendrehzahl[idx] = Radwellendrehzahl / 'Gang 2'

// continue for further gears
// would "Radwellendrehzahl" and "Gang x" be data series, you could have a loop running across the gears.
...

// return the result
return Turbinendrehzahl

support@weisang.com