DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Using curve transformations with multiple parameters

Solved!
Go to solution

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

 

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 1 of 6
(3,694 Views)
Solution
Accepted by topic author TCPlomp

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

Message 2 of 6
(3,684 Views)

Using the Call statement, fixes this issue!

 

Thanks,

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 3 of 6
(3,665 Views)

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

0 Kudos
Message 4 of 6
(3,168 Views)

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

0 Kudos
Message 5 of 6
(3,154 Views)

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 

0 Kudos
Message 6 of 6
(3,139 Views)