Export of table results in PDF
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Chunru
am 17 Okt. 2023
Bearbeitet: Chunru
am 17 Okt. 2023
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 Kommentare
Chunru
am 18 Okt. 2023
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)
Siehe auch
Kategorien
Mehr zu Vector Autoregression Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!