Skip to content

ndr.string.channelstring2channels

  ndr.string.channelstring2channels - convert a channel string to an array of channel prefiex and numbers

  [CHANNELNAMEPREFIX, CHANNELNUMBER] = ...
       ndr.string.channelstring2channels(CHANNELSTRING)

  Given a CHANNELSTRING, returns a cell array of channel prefixes and
  an array of channel numbers that correspond to the CHANNELSTRING.

  A CHANNELSTRING is a means of specifying channels that have prefixes and
  numbers. It includes a sequence of letters, followed by numbers to specify
  the channels. One can indicate a sequential range of channels by using a
  dash ('-') and one can enumerate individual channels with a comma (',').
  Different channel prefixes can be specified by placing a plus ('+') between
  sets of channels.

  Examples: 
       [cp, cn] = ndr.string.channelstring2channels('a1,3-5,2')
       % cp == {'a','a','a','a','a'}'
       % cn == [1 3 4 5 2]'
       [cp, cn] = ndr.string.channelstring2channels('ai1-3+b2-4')
       % cp == {'ai','ai','ai','b','b','b'}'
       % cn == [ 1 2 3 2 3 4]'