Contents<< Prev | Next >> 
expandstr
Expand indexed strings.

Description
F = expandstr('PP[RANGE]SS') returns a cell array of strings in the form 
'PP0000nSS', where 'PP' and 'SS' are prefix and suffix substrings, n is 
an index lying in the range RANGE, paded with 5 zeros.  RANGE is a 
vector, that can be in the form [N1 N2 N3..], or START:END, or 
START:STEP:END, or any other MATLAB valid syntax. 
 
F = expandstr('PP[RANGE,NZ]SS') also specifies the number of zeros to 
pad the index string (NZ=5 by default). For example, 'B[1:4,2].v*' 
gives {'B01.v*','B02.v*','B03.v*','B04.v*'}. 
 
F = expandstr('PP[RANGE,NZ.NP]SS') also specifies the number of digits 
NP after the decimal point (NP=0 by default). For example, 
'dt=[1:0.5:2,2.3]s' gives {'dt=1.000s','dt=1.500s','dt=2.000s'}. 
 
If the input string has more than one bracket pair [], expandstr is 
called recursively for each pair. For example, 'B[1:4,2]_[1 2,1]' 
gives {'B01_1','B01_2','B02_1','B02_2','B03_1','B03_2','B04_1','B04_2'} 
 
expandstr is useful when applied to file names, e.g. with rdir. In 
particular, wildcards (*) may be present in PP or SS (but they are 
kept as wildcards, i.e. they are not interpreted). For example, 
expandstr('B[1 2 3,5]*.*') returns {'B00001*.*','B00002*.*',..}. Note 
that expandstr is automatically called from rdir. 
 
Examples
 
 
expandstr('DSC[2:2:8,4].JPG') returns 
  {'DSC0002.JPG','DSC0004.JPG','DSC0006.JPG','DSC0008.JPG'} 
 
expandstr('Myfiles_dt=[1:0.5:2,5.2]s.*') returns 
  {'Myfiles_dt=01.00s.*','Myfiles_dt=01.50s.*','Myfiles_dt=02.00s.*'} 
 
rdir(expandstr('B[1:10,5]*.*'))  is equivalent to rdir('B[1:10,5]*.*') 
 
See Also
rdir. 

 Previous: cdwNext: getfilenum 


Help file generated by makehtmldoc 1.22