How to extract data from PDF that contains a plot and a table
104 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi,
I have thousands of PDFs that has similar format to the one attached. It starts with a plot, then it has a summary table with values.
I need to be able to extract the numbers in the table and store them in a matrix to be processed later (can exclude first column due to the word "average"). I will also need to be able to loop/read through the pdfs and extract the numbers. the PDF's name are in a number sequential order.
I have tried several things and it didn't work. I will appreciate any help. Thanks in advance.
2 comentarios
sherry james
el 28 de Dic. de 2018
Hi,
As you said you want to extract the numbers present in the table then you should use some application that can easily extract data from PDF. Once such utility is SysTools PDF Toolbox Software. With this software you can extract numbers from multiple PDF documents and the data for each individual PDF is saved in the seperate .txt document.
Visit the link & extract numbers: https://www.systoolsgroup.com/pdf-toolbox.html
Respuestas (3)
Surbhi Pillai
el 31 de Dic. de 2018
Hi Camila
You can refer to the below MATLAB Answers link to understand the extraction of data from a pdf file in MATLAB.
I hope this helps....
0 comentarios
DGM
el 29 de Nov. de 2023
fname = '35517.001.pdf';
str = extractFileText(fname);
% get the main table
T = extractBetween(str,'Dmax','AVERAGE');
T = strcat('Dmax',T);
T = split(T,newline);
% get rid of empty lines, reshape
mk = ~cellfun('isempty',T);
T = T(mk);
T = reshape(T,[],7);
% get the last row (the column averages)
lastrow = extractAfter(str,'AVERAGE');
lastrow = split(lastrow,newline);
% get rid of empty lines, reshape
mk = ~cellfun('isempty',lastrow);
lastrow = lastrow(mk);
lastrow = reshape(lastrow,[],7);
% convert to numeric data
data = str2double(T(2:end,:))
averages = str2double(lastrow)
% extract column headers if you want to make a table or something
headers = T(1,:)
Generally, it's not that simple. See also:
You can't generally rely on tabular data being presented in the expected order. In my experience, it's not even guaranteed that a set of similar-looking related files has a consistent ordering. I don't know how extractFileText() works, but I bet that you will have to check the integrity of all your extracted data if you want to be sure it's not mixed up nonsense.
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!