Create function to extract data from .log file
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
haisheng yu
el 28 de Sept. de 2017
Comentada: Walter Roberson
el 28 de Sept. de 2017
Dear all,
I want to write a function can extract data from log file. It like that

The number marked yellow is the number what I want to output and then used to do the calculate. I would really appreciate that if anyone can provide any help.
Thanks in advance.
0 comentarios
Respuesta aceptada
Walter Roberson
el 28 de Sept. de 2017
S = fileread('NameOfYourLogFileGoesHere.log');
value_of_interest_string = regexp('(?<=it\.it-nin\.icytot\.nrep2\.mtfail\.IMPES:\s*)\S+', 'match');
value_of_interest = str2double(value_of_interest_string);
This code does not assume that the value is an integer, just that it appears after the mtfail.IMPES: string and ends in whitespace.
7 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Characters and Strings en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!