10-13-2010 03:05 AM
I would like to use the function ChnLinScale as a curvetransformation in DIADem Report.
I created the following sub in my User Command file:
Sub ScaleAndOffset (dCustScale,dCustOffset)
Call ChnCopy (CurveTransfInX ,CurveTransfOutX )
Call ChnLinScale(CurveTransfInY,CurveTransfOuty,dCustScale,dCustOffset)
End Sub
With this function I expected to use the Curve Transformation 'ScaleAndOffset (3,5)' to multiply and offset my signal. However when I use that I get the following error:
'Cannot use parentheses when calling a Sub'
For a single parameter, I can use this construct:
Sub ScaleAndOffset (dCustScale)
Call ChnCopy (CurveTransfInX ,CurveTransfOutX )
Call ChnLinScale(CurveTransfInY,CurveTransfOuty,dCustScale,0)
End Sub
without a problem.
Is this by design?
Ton
Solved! Go to Solution.
10-13-2010 12:09 PM
Hi Ton,
No, this is not a limitation of the Curve Transformations but is rather a question of VBScript syntax. Any time you call a VBScript Sub or Function which has more than 1 parameter, you HAVE to use the "Call " prefix. For a Sub or Function with no parameters or only 1 parameter, you can omit the "Call ". I tested this with the following Curve Transformation assignment:
"Call CurveSmooth(100, 1)"
...which calls the below 2 parameter Curve Transformation User Command:
Sub CurveSmooth(SmoothPts, SmoothSym)
SmoothType = "symmetric"
IF SmoothSym <> "" AND SmoothSym <> 0 THEN SmoothType = "maxNumber"
Call ChnCopy(CurveTransfInX, CurveTransfOutX) 'Copy the input channel into the output channel
Call ChnSmooth(CurveTransfInY, CurveTransfOuty, SmoothPts, SmoothType) 'Smooth the input channel and save the result as output channel
End Sub
Brad Turpin
DIadem Product Support Engineer
National Instruments
10-14-2010 12:29 PM
Using the Call statement, fixes this issue!
Thanks,
Ton
03-17-2014 05:19 AM
Hi,
I've tried to acomplish a similar task with the current version of DIAdem. As I've seen, there is a new way to set a transformation function. Using this way it isn't possible to hand over parameters to this function. Another problem is that this function is used for all channels. What are the advantages of this "new" way of setting the transformation function? In my opinion the old one is way more flexible. Will this old possibility be removed and deprecated anytime?
Best,
Martin
03-17-2014 01:14 PM
Hi Martin,
Curve Transformations were first released in DIAdem 10.1. There are new drag&drop events for REPORT in DIAdem 2012, but I'm unclear what "new way" for curve transformation you mean.
What version of DIAdem are you working with?
Brad Turpin
DIAdem Product Support Engineer
National Instruments
03-18-2014 02:59 AM
Hi Brad,
thanks for your quick reply. I'm working with the version 12.0.1f5436. What I mean is, that there are two ways to define a function for the curve transformation event in the dialog (see EventDefinition.png in the attachment). When using the "old way" it is possible to hand over parameters to this function and set a different function for every curve in the diagramm. This is not possible with the "new way".
Best,
Martin