Showing results for 
Search instead for 
Did you mean: 

Rounding analysis

Hi, can someone please explain me, how to use the Basic function "Rounding"?

i try to round time channel, which is equidistant, there is proper values in it, but the dialog window in the preview block still tells me "Wrong number of arguments or assigning value".

When i change the parameters, still no change and i cant make it working.



0 Kudos
Message 1 of 4

See below for script method.  See attachment for images showing method using Analysis panel.


'-- Author: Mechatronic Solutions LLC
' Mark W Kiehl
' www.SavvyDiademSolutions.com
' www.MechatronicSolutionsLLC.com
'-- License: http://www.savvydiademsolutions.com/license.php
'-- Comment: Round a channel's values using the function ChnRound()
Option Explicit

'Load a DIAdem example data file
Call Data.Root.Clear(): Portal.NoOfGroupsToExpand = 1
If FileExist(sFilePathDIAdemExample("Example.tdm")) Then
Call DataFileLoadSel(sFilePathDIAdemExample("Example.tdm"),"TDM","[1]/[1,2]")
ElseIf FileExist(sFilePathDIAdemExample("Example.tdms")) Then
Call DataFileLoadSel(sFilePathDIAdemExample("Example.tdms"),"TDMS","[1]/[1,2]")
ElseIf FileExist(sFilePathDIAdemExample("Example_data.tdm")) Then
Call DataFileLoadSel(sFilePathDIAdemExample("Example_data.tdm"),"TDM","[1]/[1,2]")
Call LogFileWrite("DIAdem example files cannot be found")
End If
'Round a copy of the Speed channel
RoundMode = "Standard"
RoundDigitType = "DecimalDigits"
RoundDigitCount = 3
RoundIP = False
Dim oChn, oElementList
Set oChn = Data.Root.ChannelGroups("Example").Channels("Speed")
Set oElementList = ChnRound(oChn, "Standard", "DecimalDigits", 3, False)
oElementList.Item(1).Name = "SpeedRounded"
'Show the result in a channel table in the View panel
Call View.NewLayout
Dim oArea: Set oArea = View.ActiveSheet.ActiveArea
oArea.DisplayObjType = "ChannelTable"
Call oArea.DisplayObj.Columns.Add(oChn.GetReference(eRefTypeIndexIndex))
Call oArea.DisplayObj.Columns.Add(oElementList.Item(1).GetReference(eRefTypeIndexIndex))
Call WndShow("VIEW")


Function sFilePathDIAdemExample(ByVal sFilename)
'Returns the full absolute file/path for the location of the DIAdem
'example (TDM/TDMS) file sFilename. Looks in the usual places.
'Returns "" if the file cannot be found.
sFilePathDIAdemExample = ""
Dim arrFilePaths, sFilePath, sFolder
ReDim arrFolders(1)
arrFolders(0) = ProgramDrv
arrFolders(1) = CommonDocumentsPath
Call MsgLineDisp("Searching DIAdem examples for file '" & sFilename & "'..")
For Each sFolder In arrFolders
arrFilePaths = DirListGet(sFolder,sFilename,"Date/Time","FullFilenamesRecursive")
If IsArray(arrFilePaths) Then
For Each sFilePath In arrFilePaths
If InStr(1,sFilePath,"Libr",vbTextCompare) = 0 Then
sFilePathDIAdemExample = sFilePath
Exit For
End If
End If
If Len(sFilePathDIAdemExample) > 0 Then Exit For
If IsArray(arrFilePaths) Then Call Erase(arrFilePaths)
If IsArray(arrFolders) Then Call Erase(arrFolders)
Call MsgLineDisp(vbTab)
End Function 'sFilePathDIAdemExample()


0 Kudos
Message 2 of 4

Thanks for reply, in attachement i made you pic of what it shows to me.

i got simple channel i just kept 24 values, numeric channel. so i dont see why it triggers error, can someone pleaser explain me? thanks


0 Kudos
Message 3 of 4

Can you pleas save only the time channel to a file and then post here so I can look at it.  

0 Kudos
Message 4 of 4