How to use extractBetween command?
Show older comments
Hello,
I have a question about a command I want to use. First I have an input .txt value with many lines. From all the line of the input file I would like to separate the lines that between lines
*** SUMMARY OF DATA ***
and
*** END OF SUMMARY ***
I am attaching the input file
I am using these commands:
yy=(regexp(fileread('input.txt'), '\r?\n', 'split')) .';
mid = extractBetween(string(yy),"*** SUMMARY OF DATA ***","*** END OF SUMMARY ***")
but command window shows me
345×0 empty string array
and does not give me the lines between these phrases I would like.
Could you please help me?
Accepted Answer
More Answers (1)
Walter Roberson
on 28 May 2022
0 votes
Do not do the regexp split until after the extraction
Categories
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!