Enhanced Channel.listall() Function


Recommended Posts

Request: a function like Channel.ListAll() except that it returns a 2D string array with all the other fields as well as the channel name.  Could be a new function, or a new optional parameter added to the current function.  If you want to make the new parameter more than just a bool that means *return verbose mode", you could make the parameter a bitpack word, with one position per field, although the name should probably always be returned.  So by setting the appropriate bits, the user could request in addition to the name, the Timing, Offset, and Notes for example.  Not a big deal if that's a lot of work, because it's easy to subset the return array if the function returns everything.

 

Thanks!

Link to comment
Share on other sites

You can actually do this yourself now.  Just do listall() to get a string array with the channel names, stick that as the first column of a 2D string array, then cycle through using evaluate() to retrieve whichever parameters you want.  Something like this (off the cuff):

 

private string chans = channel.listall()

for (private i = 0, i < numrows(chans), i++)

   chans[1] = evaluate(chans[0] + ".Timing")

   chans[2] = evaluate(chans[0] + ".Offset")

endfor

 

You might need a doubleTostr() in there for the numerics.  I personally would do it into an object with a bunch of arrays, or an array of objects so you don't have to remember which column is which.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.