How to convert to latex display from a cell array?

8 ビュー (過去 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 Center および File ExchangeEnvironment and Settings についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by