DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

assign a unit to a unitless channel

Hello,

 

I'm having some trouble regarding the command to assign a unit to one of my channels which by default does not have an assigned unit. I attempted to use the script recorder function however it did not produce any code for that task. It would only work when converting to a new unit from an exixting one.

 

I attemted to use the below code with my channel [1]/Timechannel.

 

http://zone.ni.com/reference/en-XX/help/370859H-01/procauto/procauto/procauto_calculate_channelunits...

 

Any input would be appreciated.

 

Thanks

Dan

0 Kudos
Message 1 of 3
(4,421 Views)

Hello Dan,

 

The code to assign a unit to a channel is:

 

Data.Root.ChannelGroups(1).Channels("Time").Properties("unit_string").Value = "V"

 This would assign the unit Volt to the channel called "Time" in group 1.

 

You can also assign units to channels in a DataPlugin, which would have the effect of automatically assigning units to channels when you load the data, and making units searchable in the DataFinder.

 

I hope this helps,

 

     Otmar

Otmar D. Foehner
0 Kudos
Message 2 of 3
(4,403 Views)

Thanks Otmar.

 

That is exaclty what I was looking for.

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