MATLAB: How to pad all numbers in array

pad

How can I pad a vector of number with zeros ? I am able to do it with a for loop but I was wondering if there is a neater way to do it ?
For example,
a = [1 2 3 4 5];
b = sprintf('%06d',a);
gives me '000001000002000003000004000005'
I would like it to be [000001 000002 …..];

Best Answer

b = sprintf(' %06d',a{:});
^ add this space