Replace name in the graphic

2 visualizzazioni (ultimi 30 giorni)
Touré Mohamed
Touré Mohamed il 28 Mar 2021
Commentato: Touré Mohamed il 28 Mar 2021
Hi Everyone!
I would like to replace the names for this graphic with another name. For example, replace rdp with GDP, tx_inf with TAX.... I thank you very much for your help.
My code is:
dynare thesimy.mod;
irf1 = oo_.irfs;
save thesimy.mat irf1;
dynare thesimy2.mod;
irf2 = oo_.irfs;
save thesimy2.mat irf2;
load('thesimy.mat','irf1');
load('thesimy2.mat','irf2');
ending_cell={'_eps_a','_eps_r','_eps_g','_eps_tau'};
%'rdp', 'tx_infl', 't_cres', 'tax_jrn', 'h_prod'
for ii=1:length(ending_cell)
HOR=1:options_.irf;
var={'rdp', 'tx_infl', 't_cres', 'tax_jrn', 'h_prod'};
figure
for jj=1:length(var)
subplot(3,3,jj)
eval(['irf1.' var{1,jj},ending_cell{1,ii}]);
eval(['irf2.' var{1,jj},ending_cell{1,ii}]);
hold on
plot(HOR,[eval(['irf1.' var{1,jj},ending_cell{1,ii}])],'-k',HOR,[eval(['irf2.' var{1,jj},ending_cell{1,ii}])],'--r','LineWidth',2);
title([var{1,jj}] )
end
legend('thesimy', 'thesimy2', 'AutoUpdate','off')
end

Risposta accettata

Walter Roberson
Walter Roberson il 28 Mar 2021
Currently, the values in var={'rdp', 'tx_infl', 't_cres', 'tax_jrn', 'h_prod'}; are used as the titles, and also as the field names of variables to retrieve. So you should
var={'rdp', 'tx_infl', 't_cres', 'tax_jrn', 'h_prod'};
var_titles = {'GDP', 'TAX', 'Crespiatica', 'Jargonize', 'Productida'};
and change
title([var{1,jj}] )
to
title([var_titles{1,jj}] )
  1 Commento
Touré Mohamed
Touré Mohamed il 28 Mar 2021
Thank you very much, Walter. Your answer was helpful.

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by