Extract Data from .txt File
3 次查看(过去 30 天)
显示 更早的评论
Hi, someone can help me extract data from this .txt File? I'm interested in extracting the numeric values of "PeakEvm" that appears in the file.
I have tried to use textscan, pattern, extract and extractBetween but they are useless for this task.
0 个评论
采纳的回答
C B
2021-10-27
编辑:C B
2021-10-27
alltext = fileread('Datos_SSB_624_MHz_7_dB.txt');
% extract data between {"peakEvm": and },
allmatches = regexp(alltext,'(?<={"peakEvm":).*?(?=},)','match')
% extract data between {"percent": and ,
num1 = regexp(allmatches,'(?<={"percent":).*?(?=,)','match');
% extract data between "subcarrierNumber": and ,
num2 = regexp(allmatches,'(?<="subcarrierNumber":).*?(?=,)','match');
% extract data between "symbolNumber": and end
num3 = regexp(allmatches,'(?<="symbolNumber":).*?(?=)','match');
vertcat(num1{:})
vertcat(num2{:})
vertcat(num3{:})
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import and Export 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!