% This function removes all the spaces in the % beginning and the end of an input string function s_out = deblank2(s_in) s_in = deblank(s_in); if (isempty(s_in)) return; end; for i = 0:length(s_in)-1 temp(i+1) = s_in(length(s_in)-i); end temp = deblank(temp); for i = 0:length(temp)-1 s_out(i+1) = temp(length(temp)-i); end