| 本帖最后由 meatball1982 于 2016-3-2 22:19 编辑 
 回答别人的问题.研究了点东西.
 用latex 作为字符的输出.如果里面有\text 会出错.
 因为matlab不认\text
 这是一个在latex 的$$环境当中写字符的东西.
 几个选择,
 1把字符拿出$$环境.
 2.用\mbox而不是\text
 3.出错,给warning ,但不是你要的结果.
 
 
   
 
 复制代码
function showLatex(str)
% if ~ischar(str)
%    disp('You input must be a char.');
%    return;
% else
   h=figure('Name','VLatex Display','NumberTitle','off','menubar','none',...
      'Toolbar','none','position',[520 550 600 200]);
   color=get(h,'color');
   ha=axes('parent',h,'xColor',color,'YColor',color,'Color',color,...
      'position',[0,0,1,1]);
   text('string',str,'interpreter','Latex','fontsize',14,'position',[0,0.5]);
% end
 复制代码clear all
clc
close all
 str1='str1:$C_s^{ADS}$(z)';
 str2='str2:$C_s^{ADS}(\mbox{z})
;
 str3='str3:$C_s^{ADS}\text(z)
;
showLatex(str1)
showLatex(str2)
showLatex(str3)
 
 
 |