function texText(str,location,x,y,units)
% places a TeX formated string in the title, x axis or y axis
%str = ['$',str,'$'];

switch location
    case 'x'
        xlabel(str,'interpreter','latex');
    case 'y'  % x label
        ylabel(str,'interpreter','latex');
    case 'z'  % z label
        zlabel(str,'interpreter','latex');
    case 't'  % in the title
        title(str,'interpreter','latex');
    case 'g'  % general location
        if exist('units','var')
            text(x,y,str,'interpreter','latex','units',units);
        else
        	text(x,y,str,'interpreter','latex');
        end
    otherwise
        disp(['The second argument, ',location,', is not a valid location code.']);
        disp('Valid codes are, x,y,z,t,or g for the xyz labels, Title and General location.');
end        
end


