Effacer les filtres
Effacer les filtres

How to convert to latex display from a cell array?

7 vues (au cours des 30 derniers jours)
Ben Wang
Ben Wang le 26 Avr 2011
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

Réponse acceptée

Friedrich
Friedrich le 26 Avr 2011
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

Plus de réponses (1)

Ben Wang
Ben Wang le 26 Avr 2011
Thanks Friedrich, it works.
Cheers
Ben

Catégories

En savoir plus sur Labels and Annotations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by