DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

script to make chanel name a variable

HI,

I'm pretty new to writing script but am totally stuck on this. 

I'm trying to write a spript to create a time channel based on sampe rate (the equation is simple) but the part where i get stuck is every time i load a different set of data my script is stiff refererencing "channel group2" so what i need is an input button/drop down box.....etc to sellect what channel group it should be using. 

Any ideas? 

 

Steve

0 Kudos
Message 1 of 5
(5,082 Views)

Hi Steve,

 

I am Ed from National Instruments Technical Support. I am happy to assist you with your request today. I'd just like to clarify, are you wanting to have this functionality in DiAdem rather than LabVIEW?

 

From what I can tell so far you could use a numeric control such as a dial, convert the numeric to string in your script and then concatenate this number to your channel name. You could also store your channel names as a string array and have a script acquire the string in the array at the given position, input from a numeric dial. Both methods can then be executed using a button. The input button is available under Visual -> Manual Instruments, which the numeric dial is also located in.

 

I hope that this is helpful and if you have any questions regarding your query please don't hesitate to ask.

 

Best Regards,

 

Ed

0 Kudos
Message 2 of 5
(5,010 Views)

Hi Steve,

 

If you want to create a script that always adds a time channel for the most recently loaded data set, then you can use the "Active Group" in your script:

 

Set Group = Data.Root.ActiveChannelGroup
Set TimeChannel = Group.Channels.Add("Time", DataTypeChnFloat64, 1)
Call ChnLinGen(TimeChannel, 0, LastXvalue, XvalueCount, "s")

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 5
(4,958 Views)

Thanks Brad, 

 

That looks useful

0 Kudos
Message 4 of 5
(4,936 Views)

Thanks Ed, 

 

I'll give that a go this afternoon. and let you know how i get on

0 Kudos
Message 5 of 5
(4,933 Views)