11-18-2024 08:14 AM
Hello,
I thought that the use of the Set statement when calling an analysis command was so that the result channel would then easily be available for further manipulation. However, this seems not to be the case as the following code doesn't work:
Option Explicit 'Forces the explicit declaration of all the variables in a script.
Dim v_smooth, Win_other
Win_other = 19
Set v_smooth = ChnSmooth("v", "v_smooth", (Win_other-1)/2, "maxNumber", "byMeanValue")
'NV smoothed ends
Call DataBlInsertVal(v_smooth, 1, (Win_other-1)/2, NOVALUE, True)
Call DataBlInsertVal(v_smooth, v_smooth.Size-(Win_other-1)/2, (Win_other-1)/2, NOVALUE, True)
The error message says that Size is not supported by the object. I'm working around this by inserting the following line after the smoothing call:
Set v_smooth = Data.GetChannel("[1]/v_smooth")
Watching the status of the variable v_smooth after the smoothing call shows that it is an object variable. The help files, however, say that it's an ElementList type.
It seems to me that it would be more useful to define the results channel as an object from which I can access it's various properties. The addition of the extra line seems inefficient. Am I missing something?
What is the point of the ElementList type?
Regards,
Simon.
11-19-2024 06:19 AM
As the name ElementList suggests, the resulting object is a list of elements. Therefore, if you want to access a property of a single channel you have to take out this single element = channel from the list:
v_smooth.Item(1).Size
11-20-2024 07:45 AM
Thanks for the response.
If I need to refer to the specific element by using v_smooth.Item(1) then shouldn't I need to do that when passing the input channel to the smoothing function? In other words:
Call DataBlInsertVal(v_smooth.Item(1), v_smooth.Size-(Win_other-1)/2, (Win_other-1)/2, NOVALUE, True)
The previous line in the code worked without needing to specify the particular element in the list. How does the function know which element I am passing to it if I don't specify it?
Regards.