DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Set channel number equal to channel index

Hi,

 

I have a script which imports an ASCII file, changes some of the channels and deletes others. I then use another script that processes the data and it does this by, generally, using channel number referencing.

 

Some of the channels are moved during the first script so that they are in the right order as far as the structure order is concerned, i.e. they have the right index number order. The channel moving was achieved by recording a script whilst manually moving them around. This gave me the following code:

 

Call Data.Move(Data.Root.ChannelGroups(1).Channels("Latac"),Data.Root.ChannelGroups(1).Channels,2)

However, this does not put them in the right order as far as channel numbers are concerned, and this causes problems with the second script. One solution is to close the file and open it again as the channel numbers are re-ordered according to their index position.

 

So, is there a function that will re-number the channels according to their index position so that I don't have to close and open the file?

 

Regards, Simon.

0 Kudos
Message 1 of 3
(5,215 Views)

Hi Simon,

 

Channel number referencing is frowned upon by DIAdem R&D because of reasons like this-- it's usually the least reliable method.  Still, there is a command that will fix your problem by forcing an official renumbering after you've done the channel rearranging.

 

Call ChnRenumber()

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

 

0 Kudos
Message 2 of 3
(5,203 Views)

Hi Brad,

 

I can appreciate that. The problem I have is that a huge effort was put into writing autosequences many years ago and they still work perfectly apart from the odd update. They will get re-written eventually - but not yet.

 

Your solution does work, but weirdly I had already rejected it because it didn't work when I did it manually by pressing the right-mouse button over the data portel list view and selecting Renumber Channels. That's because the numbers are already in numerical order, but the names are not in the order as shown in the structure, i.e. the names are not in index order. Oddly, when you call ChnRenumber it puts the channel numbers out of numerical order so they match the index order.

 

A case where the manual function call and the script call don't achieve the same thing?

 

Regards,

0 Kudos
Message 3 of 3
(5,200 Views)