padspace.m (287B)
1 % padspace.m y=padspace(x,K) 2 % 3 % Adds padding space to a string matrix to make the matrix (NxK) if it is 4 % less that K characters long. Otherwise truncates to K characters. 5 6 function y=padspace(x,K); 7 8 [N K0]=size(x); 9 if K0<K; 10 y=[x ones(N,K-K0)*' ']; 11 else; 12 y=x(:,1:K); 13 end;