DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace NoValue values in channel group

Solved!
Go to solution

I have a channel group containing multiple channels; some channels are numeric and some channels are text. Each channel has several NoValue values. Depending on the channel format, I would like to convert those NoValue values into either 0 (for numeric) or "" (for text). ChnNovHandle can do this job, although I am not sure why it requires 2 channels for input. Instead of calling many ChnNovHandle methods for each channel, is there any better way to apply this method for a whole group with selective replacement values for channels of different format?

Thank you.

0 Kudos
Message 1 of 2
(3,371 Views)
Solution
Accepted by topic author levan8421

Hi,

You can use the second channel in Process NoValues analysis function as a control channel.

The control channel will be searched for NoValues and if found, NoValues will be replaced / deleted / interpolated in the control- (x-) channel and all y-channels at the same position.

If you don't need a control channel just select "Only process one channel" option.

NVHandle.PNG

 

NoValues in general are meant to replace numeric values and not text values (quote: "A Novalue is a numeric value..."):

http://zone.ni.com/reference/en-XX/help/370858N-01/varoff/nv/

 

So when selecting a text channel which includes "novalue" strings, Process NoValues analysis function does not find any NoValues because they have the wrong data format.

 

As an alternative you can use a Calculator function to replace all "novalue" strings like this:

ch("[3]/StatisticsText") = IIF(lcase(ch("[3]/StatisticsText"))="novalue","",ch("[3]/StatisticsText"))

If you want to iterate all channels in a specific group, you can put both Process NoValues and the Calculate function in a script and select them depending on the channel data type:

dim oChn, oTextChn
for each oChn in Data.Root.ChannelGroups(3).Channels
  if oChn.DataType = DataTypeChnString then
    set oTextChn = Data.Root.ChannelGroups(3).Channels(1)
    Call Calculate("A = IIF(LCase(A)=""novalue"","""",A)", Array("A"), Array(oTextChn))
  else  
    Call ChnNovHandle("[3]/Res_Noise_1", "[1]/Speed", "SetValue", "X", 1, 1, 0)
  end if
next

(You can use the example_data.tdm file for my example and replace some values of the StatisticsText channel with "NoValue")

Christian
CLA, CTA, CLED
0 Kudos
Message 2 of 2
(3,337 Views)