How to extract data from PDF that contains a plot and a table
조회 수: 103 (최근 30일)
이전 댓글 표시
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
sherry james
2018년 12월 28일
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
답변 (3개)
Surbhi Pillai
2018년 12월 31일
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
DGM
2023년 11월 29일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!