05-12-2008 02:25 PM
05-13-2008 08:17 AM
Hi Bruce,
Where are you entering this? In the Channel Calculator? In a VBScript? If you're using the Channel Calculator, how is it supposed to know how long to make the channel? Usually there is at least one channel reference in the assignment that determines the length of the new channel. I have verified the behavior you describe in DIAdem 10.2, but when I try this in the Channel Calculator in DIAdem 10.1, I get the error "Calculation is not a channel". So it appears the behavior has changed. Are you saying you prefer the error message?
What are you trying to accomplish?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
05-13-2008 11:04 AM
05-14-2008 11:12 AM
Hi Bruce,
In DIAdem 10.1 and prior versions the ResultApprAnsatzCoef1,2,3,4 properties were not added to the ApproximatedY channel created by the ANALYSIS approximation routine, so this VBScript only has a chance in DIAdem 10.2 or later. I can get this VBScript to work by consistently addressing the channel name I have in the Data Portal as well as the group index [1] that channel is in:
R28 = 4
FormulaTxt = "Ch(""[1]/NApoint"")="
FormulaTxt = FormulaTxt & " ((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef4""))*R28^3)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef3""))*R28^2)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef2""))*R28)"
FormulaTxt = FormulaTxt & "+((ChnPropValGet(""[1]/ApproximatedY"", ""ResultApprAnsatzCoef1"")))"
Call ChnCalculate(FormulaTxt)
But you're quite right that the resulting channel still contains the value 0. If what you want is to recreate the approximation curve or to retrieve one value from the approximation curve, why don't you just reference out one of the values of the ApproximatedY channel based on the closest value in ApproximatedX to your desired R28 value? The code would look like this:
Row = PNo("[1]/ApproximatedX", R28)
MsgBox ChD(Row, "[1]/ApproximatedY")
Let me know if that is not what you want,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
05-14-2008 03:44 PM