필터 지우기
필터 지우기

Export of table results in PDF

조회 수: 12 (최근 30일)
FRANCESCOMARIA
FRANCESCOMARIA 2023년 10월 16일
댓글: Chunru 2023년 10월 18일
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?

답변 (1개)

Chunru
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)
Var1 Var2 _______ _______ 0.98776 0.24769 0.5965 0.27823 0.96934 0.47891
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))
t = 3×2 table
Var1 Var2 ________ _______ 0.044266 0.52897 0.48844 0.65341 0.43366 0.56366
  댓글 수: 7
FRANCESCOMARIA
FRANCESCOMARIA 2023년 10월 17일
It works, but is print just a part of the table I need. Like the file I Upload.
Chunru
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 CenterFile Exchange에서 Vector Autoregression Models에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by