How to read only numerical values of serial output data in MATLAB?

 Respuesta aceptada

filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/791754/Log_file.txt';
data = readmatrix(filename, 'Range', 'C:C')
data = 10×1
1562 2027 363 2808 2770 5947 3477 340 1131 2775

Más respuestas (2)

Your data file looks like a configuration file with key/value pair separated by ':'. One way to parse the data is to do this for each row:
rowStr = 'ADC0/F1 : 1562';
tokens = split(rowStr, ':');
intValue = str2double(strtrim(tokens(2)));

1 comentario

Sohail Ahmed
Sohail Ahmed el 8 de Nov. de 2021
Editada: Sohail Ahmed el 8 de Nov. de 2021
Great. But I just want the code to read all integer values at once.

Iniciar sesión para comentar.

Sohail Ahmed
Sohail Ahmed el 10 de Nov. de 2021
Thanks....... It worked.

Categorías

Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 6 de Nov. de 2021

Comentada:

el 10 de Nov. de 2021

Community Treasure Hunt

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

Start Hunting!

Translated by