필터 지우기
필터 지우기

How to convert to latex display from a cell array?

조회 수: 7 (최근 30일)
Ben Wang
Ben Wang 2011년 4월 26일
Dear all:
I am having trouble to display Greek in latex form. I have a cell array contains the following:
index = [ {'alpha'};
{'sigmaL'};
{'beta'};
{'theta'};
{'rho_a'};
{'kappa_y'};
{'kappa_pi'};
{'var_eps_a'};
{'var_eps_r'}];
Each of the cell in cell array 'index' represents a variable name and I want to plot each in one figure by using subplot. In each of the subplot, I want to have a title as the name of the variable in latex form. I know I can manually do so by adding a slash to the string, for example:
title('\fontsize{20}\alpha')
But I want to assign the name directly by referring to the cell array 'index' rather than typing the name explicitly, since in some cases not all variables are needed and I want to build a automate way to plot the variable.
count = 1;
for i = 1:row
for j = 1:col
subplot(row,col,count);
h = plot(bar_x(count,:),bar_y(count,:),'r',...
likelihood_region_Xaxis(count,:),likelihood_region(count,:),'b');
set(h,'LineWidth',4); title({\index{count}},'FontSize',20);
count = count + 1;
end
end
This is what I have tried, but Matlab doesn't seem to like it...
Any comments and help is highly appreciated, and thanks for your time and effort in advance!
Best,
Ben

채택된 답변

Friedrich
Friedrich 2011년 4월 26일
Hi Ben,
please try this
set(h,'LineWidth',4); title(['\',index{count}]) ,'FontSize',20);
instead of
set(h,'LineWidth',4); title({\index{count}},'FontSize',20);
Best regards,
Friedrich

추가 답변 (1개)

Ben Wang
Ben Wang 2011년 4월 26일
Thanks Friedrich, it works.
Cheers
Ben

카테고리

Help CenterFile Exchange에서 Labels and Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by