I am fairly new to VBS and having some difficulties coming up with a solution. I have a sine wave I need to do some calculations on. I need to cut a window each cycle at +-1000N. Than calculate linear regression on each of those sections. Than average the positive/negative slopes. In the end I am looking to produce 2 plots one for positive and one for negative. So far I have been able to cut the data and insert NoValues. I am looking for help running linear regression on each section of data between the NoValues.
Dim oChn,K,currentValue, lastValue,i
Call Calculate("Ch(""[1]/Total"")=Ch(""[1]/Filtered_Total_TR_Load"")+CTNV(Ch(""[1]/Filtered_Total_TR_Load"")>1000)",NULL,NULL,"")
Call Calculate("Ch(""[1]/Total"")=Ch(""[1]/Total"")+CTNV(Ch(""[1]/Filtered_Total_TR_Load"")<-1000)",NULL,NULL,"")
lastValue = 0
Set oChn = data.GetChannel("Total")
For K = 1 To oChn.Size
currentValue = oChn(K)
If (IsNull(currentValue)) Then
oChn(K) = lastValue
Else
lastValue = currentValue
End If
Next