Replace name in the graphic

조회 수: 3 (최근 30일)
Touré Mohamed
Touré Mohamed 2021년 3월 28일
댓글: Touré Mohamed 2021년 3월 28일
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

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 28일
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
Touré Mohamed
Touré Mohamed 2021년 3월 28일
Thank you very much, Walter. Your answer was helpful.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by