ylabeltex.m (633B)
1 function []=ylabeltex(y,str); 2 % where str=strmat('$\bar{a}$ $\bar{b}$') for example. 3 % Place tick marks at the x location as well as the LaTex strings. 4 % 5 % Revised Sep 2005: Use tex interpreter, not latex, if 6 % no $$ are found in the string: e.g. str='\bar{a} \pi'. 7 cax=axis; 8 xmin=cax(1); 9 xstep=cax(2)-xmin; 10 set(gca,'YTick',y,'YTickLabel',''); 11 12 for i=1:length(y); 13 if ~isempty(find(str=='$')); 14 text(xmin-.05*xstep,y(i),str(i,:),'Interpreter','latex','HorizontalAlignment','center','FontSize',16); 15 else; 16 text(xmin-.05*xstep,y(i),str(i,:),'Interpreter','tex','HorizontalAlignment','center','FontSize',16); 17 end; 18 end;