DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Naming channels using the names in another group.

As usual I feel like Im asking for help with something I should be able to do easily, but here goes.
 
Ive created a new group of channels which contains the average of all my other channel groups. These channels once created are taking the automatically generated names, so after calculation I am wanting to set the channel names to be the same as the other groups. I have been trying to use the code below, where chnloop identifies the channel number in question. The first line works fine if I use a integer value but as soon as I include a variable it returns a null string. The second line doesnt appear to work at all, telling me I cannot use parentheses when calling a sub.
 
axisnames = ChnPropGet(1/ chnloop, "name")
chnnameset(chnloop,axisnames)
 
So am I going about this completely wrong as usual?
 
Thanks in advance for any help.
0 Kudos
Message 1 of 4
(3,529 Views)

Hi,

The reason that you get the error message is that VBScript requires a "Call" when you call a function or subroutine which has more than one parameter. Calling a function also works if you assign the return parameter like you did in the first line of code. This is the syntax of VBScript as defined by Microsoft.
Here is what I would recommend : If you use a function and you assign the reurn value to a variable (like a = function() it works. If you call a subroutine like "sub()" alsways use "call sub()". This works, independant of the number of parameters.

Back to your specific question : To set a channel name, please use "Call ChnPropSet(1/ chnloop, "name")"

Let me know if you have further questions.

Andreas

0 Kudos
Message 2 of 4
(3,525 Views)

Thanks for the help.

I am still having a problem with the line

axisnames = ChnPropGet(1/ chnloop, "name")

This just returns an empty string but if I use

axisnames = ChnPropGet(1/ 1, "name")

then it works fine. Any ideas why this is the case?

0 Kudos
Message 3 of 4
(3,517 Views)

Please disregard the above post Ive discovered my error. I was trying to reference including the group rather than just with the channel number.

Thanks again.

0 Kudos
Message 4 of 4
(3,510 Views)