From: Luca Zanotti Fragonara on 22 Feb 2010 10:40 Hello eveyone. I have a problem. In one of my label in a figure, I should use subscipts, in this way: legend(['Identified \alpha_', num2str(ind)],['Exact \alpha_', num2str(ind)]); Because ind is a number, it may have more than two cipher. So, if it wasn't an index, I would write: legend('Text_1_0'), But, because in this case my number is num2str(ind), if ind is more than 10, how can override the problem that only the first cipher is a suscript? Thank you in advance! Luca
From: Steven Lord on 22 Feb 2010 10:56 "Luca Zanotti Fragonara" <Luca_Zanotti(a)libero.it> wrote in message news:hlu8h7$php$1(a)fred.mathworks.com... > Hello eveyone. I have a problem. > > In one of my label in a figure, I should use subscipts, in this way: > > legend(['Identified \alpha_', num2str(ind)],['Exact \alpha_', > num2str(ind)]); > > Because ind is a number, it may have more than two cipher. So, if it > wasn't an index, I would write: > > legend('Text_1_0'), > > But, because in this case my number is num2str(ind), if ind is more than > 10, how can override the problem that only the first cipher is a suscript? Enclose your subscript in curly brackets. plot(1:10) legend('Text_{10}') -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
From: us on 22 Feb 2010 10:59 "Luca Zanotti Fragonara" <Luca_Zanotti(a)libero.it> wrote in message <hlu8h7$php$1(a)fred.mathworks.com>... > Hello eveyone. I have a problem. > > In one of my label in a figure, I should use subscipts, in this way: > > legend(['Identified \alpha_', num2str(ind)],['Exact \alpha_', num2str(ind)]); > > Because ind is a number, it may have more than two cipher. So, if it wasn't an index, I would write: > > legend('Text_1_0'), > > But, because in this case my number is num2str(ind), if ind is more than 10, how can override the problem that only the first cipher is a suscript? > > Thank you in advance! > > Luca one of the (more tedious) solutions - if(f) i understand you correctly ind=123; fh=@(x) sprintf('_%c',strread(sprintf('%d',x),'%c')); leg=['Identified \alpha',fh(ind)] % leg = Identified \alpha_1_2_3 us
From: Luca Zanotti Fragonara on 22 Feb 2010 12:04 Thank you both for the solution. But I like more the first solution. I've solved in this way: legend(['Identified \alpha_{', num2str(ind),'}']);
|
Pages: 1 Prev: how to do SYMBOLIC OPTIMIZATION Next: Execute an m file from the command line |