DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Result Channel Object

Solved!
Go to solution

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.

0 Kudos
Message 1 of 6
(317 Views)

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

DIAdem experience since 1996

Turn-key applications - Remote and on-site trainings - On-the-job training

| müller+krahmer GmbH | Koenitzer Straße 14, 07338 Kaulsdorf / Germany |
| Phone: +49 36733 / 2328 - 6 | Mobile: +49 160 / 287 7294 |
| Email: mueller@mueller-krahmer.de | Web: www.mueller-krahmer.de |
0 Kudos
Message 2 of 6
(293 Views)

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.

0 Kudos
Message 3 of 6
(283 Views)
Solution
Accepted by topic author Simon_Aldworth

The first parameter of DataBlInsertVal is a channel list, so use v_smooth there. The second a numeric value, in that case calculated form the length of a certain channel: v_smooth.Item(1).Size

 

Call DataBlInsertVal(v_smooth, v_smooth.Item(1).Size ...

 

DIAdem experience since 1996

Turn-key applications - Remote and on-site trainings - On-the-job training

| müller+krahmer GmbH | Koenitzer Straße 14, 07338 Kaulsdorf / Germany |
| Phone: +49 36733 / 2328 - 6 | Mobile: +49 160 / 287 7294 |
| Email: mueller@mueller-krahmer.de | Web: www.mueller-krahmer.de |
0 Kudos
Message 4 of 6
(249 Views)

Thank you.

 

I must admit that whilst I understand what's going on, I'm still confused as to why commands like ChnSmooth provide their results in ElementList form. If they were working on multiple input channels then I can see why they would put all the output channels in a single list variable. However, ChnSmooth only works on one channel at a time, so why not just put the result in a channel object?

 

You would then have direct access to the channel properties without needing to know which element it is in the list.

 

Regards.

0 Kudos
Message 5 of 6
(233 Views)

I suppose the only reason that this command with only one result channel returns an ElementList is standardisation, as all other similar operations return this list too.

DIAdem experience since 1996

Turn-key applications - Remote and on-site trainings - On-the-job training

| müller+krahmer GmbH | Koenitzer Straße 14, 07338 Kaulsdorf / Germany |
| Phone: +49 36733 / 2328 - 6 | Mobile: +49 160 / 287 7294 |
| Email: mueller@mueller-krahmer.de | Web: www.mueller-krahmer.de |
0 Kudos
Message 6 of 6
(165 Views)