STRPAD Pads a string with blank spaces until it is N characters long. If s is already N characters long (or longer) then the string is truncated. M Hewitson 27-04-07 $Id: strpad.html,v 1.1 2007/06/08 14:15:10 hewitson Exp $
0001 function so = strpad(s, N) 0002 0003 % STRPAD Pads a string with blank spaces until it is N characters long. If 0004 % s is already N characters long (or longer) then the string is truncated. 0005 % 0006 % M Hewitson 27-04-07 0007 % 0008 % $Id: strpad.html,v 1.1 2007/06/08 14:15:10 hewitson Exp $ 0009 % 0010 0011 while length(s) < N 0012 s = [s ' ']; 0013 end 0014 0015 so = s(1:N); 0016 0017 0018 % END