Export of table results in PDF
34 ビュー (過去 30 日間)
古いコメントを表示
close all
clear all
clc
[xlsdata, xlstext] = xlsread('SW3.xlsx','Foglio1');
t = datetime(xlstext(2:end,1),"Format","dd/MM/uu");
DataTimeTable = table(t,xlsdata(1:end,1),xlsdata(1:end,2),xlsdata(1:end,3),xlsdata(1:end,4),xlsdata(1:end,5),xlsdata(1:end,6),xlsdata(1:end,7));
DataTimeTable.Properties.VariableNames = xlstext(1,1:8);
INFO = xlsdata(1:end,1);
mth3USArate = price2ret(DataTimeTable.USA3mth);
mth3USArate = [0; mth3USArate];
CPIUS = xlsdata(1:end,3);
UnempUS = price2ret(DataTimeTable.unempUS);
UnempUS = [0; UnempUS];
USDto1eu = price2ret(DataTimeTable.USDto1euro);
USDto1eu = [0; USDto1eu];
gfc = xlsdata(1:end,6);
UnempEU = price2ret(DataTimeTable.unempUE);
UnempEU = [0; UnempEU];
UnempEU(isinf(UnempEU)|isnan(UnempEU)) = 0
tbl = table(INFO,mth3USArate,CPIUS,UnempUS,USDto1eu,gfc,UnempEU);
tbl = rmmissing(tbl);
T = size(tbl,1); % Total sample size
numseries = 7;
numlags = (1:4)';
nummdls = numel(numlags);
% Partition time base.
maxp = max(numlags); % Maximum number of required presample responses
idxpre = 1:maxp;
idxest = (maxp + 1):T;
% Preallocation
EstMdl(nummdls) = varm(numseries,0);
aic = zeros(nummdls,1);
% Fit VAR models to data.
Y0 = tbl{idxpre,:}; % Presample
Y = tbl{idxest,:}; % Estimation sample
for j = 1:numel(numlags)
Mdl = varm(numseries,numlags(j));
Mdl.SeriesNames = tbl.Properties.VariableNames;
EstMdl(j) = estimate(Mdl,Y,'Y0',Y0);
results = summarize(EstMdl(j));
aic(j) = results.AIC;
end
[~,bestidx] = min(aic);
p = numlags(bestidx)
BestMdl = EstMdl(bestidx);
h = gctest(BestMdl);
CONSIDERING THE RESULTS OF THIS CODE, HOW CAN I PRINT IT AS A PDF TABLE AND EXPORT FROM MATLAB?
0 件のコメント
回答 (1 件)
Chunru
2023 年 10 月 17 日
編集済み: Chunru
2023 年 10 月 17 日
You can use livescript. Then you can hide the code and export to pdf.
For example
t=array2table(rand(3,2));
disp(t)
Or you can export a formatted table with grid as follows (the display below is not the same from livescript):
t=array2table(rand(3,2))
7 件のコメント
Chunru
2023 年 10 月 18 日
The reson may be that your table is too big to fit into the page width of pdf.
Try the following
export->export to pdf->Show more -->Paper size --> A2/landscape (or custom for larger widths)
参考
カテゴリ
Help Center および File Exchange で Vector Autoregression Models についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!