DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

to split channel into pieces(cycle)

hi

i dont know how i can split channel into pieces. in attachmeents i have piece of my data, i have there data which are use to axis X and axisY on my graph. In my data i have many cells where i have "novalue"(it is result from many calculation) and on graph it isnt curve but only many points, it look like curve but isnt, but it is not big problem. data from channel "axis X" show when new cycle is strated (one cycle= 0,25...as long as 719,75). I must in some way separate cycle(split channel into cycles) and calculation (receive) one average cycle. How i can do it ??

0 Kudos
Message 1 of 4
(5,133 Views)
in attachments is picture which show graph with all my data
0 Kudos
Message 2 of 4
(5,123 Views)
Hi Elwis_85!

I am not sure what you want to accomplish but it seems you operate on channels and do some looping. For creating such applications you can use scripting.

I have prepared an example that for every value (not NOVALUE) from Channel3 (from 0.25 to 719.75) stores value from Channel2 in separate channel. I used VBS scripting to accomplish that.

Please remember to check channel names before running the script. I hope it will be useful!

Script:

'requirements:
' Channel3: values from 0.25 to719.75
' Channel2: if Channel3 is not NOVALUE, read from channel2 data
' ChannelOut: channel that will store values from channel2, set length to length of Channel2

Option Explicit 'Forces the explicit declaration of all the variables in a script.
dim ind
dim v
ind = 4 ' start indexing from 4th row
dim newind 'here we store index of newly created channel where we store values

newind = 1 'start indexing new channel from 1
v = 1 'init value
while (v <> 719.75) 'read as long as you don't reach maximum value
v = ChV(ind,"pieceaxelXY/Channel 3") 'read value
if IsNull(v) then 'compare it to NOVALE
v = 0.0 'if it is NOVALUE set to to 0, to work on Double data type
end if
if v<>0 then 'v<>0 means that we read some value, now we can read value from Channel 2 and store it in ChannelOut
CHV(newind,"pieceaxelXY/ChannelOut") = ChV(ind,"pieceaxelXY/Channel 2") 'read from Channel 2 and store it in ChannelOut
newind = newind + 1 'increase index in ChannelOut
end if
ind = ind + 1
wend

Best regards,
Koza
Message 3 of 4
(5,008 Views)

Hi again Elwis,

 

Your data looks mighty familiar, but I'm going to assume that this latest data set came from a different source than the other VBScripts I wrote for you.  Here's an example of how to start with the data as you have it in Excel and morph it into the same output that you wanted before.

 

Brad Turpin
DIAdem Product Support Engineer
National Instruments

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