how do I display all the text on one line?

16 views (last 30 days)
Hi everyone, I have a problem: I extracted the text on matlab using str = extractFileText (filename) command, when I press on run my output in the command window gives me the text with the original formatting, while to me you need to make the text appear on a single line. How can I do? thanks in advance to those who answer me

Accepted Answer

Adam Danz
Adam Danz on 20 Mar 2020
Edited: Adam Danz on 20 Mar 2020
Try this.
filename = 'swire.pdf';
str = extractFileText(filename);
c = regexprep(str,{char(13),char(10)}, ''); % or replace with ' '
size(c{1}) % = 1 x 204710

Sign in to comment.

More Answers (1)

Monika Jaskolka
Monika Jaskolka on 20 Mar 2020
Did you try removing the newlines (or other formatting characters)?
Emanuela riccio
Emanuela riccio on 20 Mar 2020
Edited: Emanuela riccio on 20 Mar 2020
ok monika the file is swire and it is about 100 pages ...thanks always

Sign in to comment.


Find more on Characters and Strings in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!