Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


pad_strn.m

Go to the documentation of this file.
00001 function S = pad_strn (strg,padchar,n,loc)
00002 %       S = PAD_STRN (strg,padchar,n,loc)
00003 %This function pad the string 'strg' with 'padchar' characters
00004 %  such that 'S' is 'n' characters long.
00005 % if loc = 1 the 'padchar' are added to the left of 'strg'
00006 % if loc = -1 the 'padchar' are added to the right of 'strg'
00007 
00008 
00009 if (~ischar(strg) | ~ischar(padchar)),
00010         err = ErrEval(mfilename, 'Err_First two arguments must be characters');
00011         S = '';
00012         return;
00013 end
00014 
00015 S = strg;
00016 while (length(S) < n)
00017 
00018         if (loc == 1),
00019                 S = sprintf ('%s%s',padchar,S);
00020         elseif (loc == -1),
00021                 S = sprintf ('%s%s',S,padchar);
00022         end
00023 
00024 end;
00025 
00026 return;
 

Powered by Plone

This site conforms to the following standards: