int2str2

PURPOSE ^

Convert integer to string of given length; improved version of int2str.

SYNOPSIS ^

function nstr = int2str2( n, nDigits )

DESCRIPTION ^

 Convert integer to string of given length; improved version of int2str.

 Pads string with zeros on the left.  For integers similar to
  sprintf( '%03i', n ); %for nDigits=3
 If input n is an array, output is a cell array of strings of the same
 dimension as n.  Works also for non integers (pads to given length).

 USAGE
  nstr = int2str2( n, [nDigits] )

 INPUTS
  n        - integer to convert to string
  nDigits  - [0] minimum number of digits to use

 OUTPUTS
  nstr     - string repr. of n (or cell array of strings if n is array)

 EXAMPLE
  s = int2str2( 3, 3 ) % s='003'

 See also INT2STR

 Piotr's Computer Vision Matlab Toolbox      Version 1.5
 Copyright 2014 Piotr Dollar.  [pdollar-at-gmail.com]
 Licensed under the Simplified BSD License [see external/bsd.txt]

Generated by m2html © 2003