How to read only numerical values of serial output data in MATLAB?
8 views (last 30 days)
Show older comments
Sohail Ahmed
on 6 Nov 2021
Commented: Walter Roberson
on 10 Nov 2021
I just want to read the integer values (number) in the output text file (serial data)...... I need some assistance.....
0 Comments
Accepted Answer
Walter Roberson
on 8 Nov 2021
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/791754/Log_file.txt';
data = readmatrix(filename, 'Range', 'C:C')
0 Comments
More Answers (2)
Yongjian Feng
on 6 Nov 2021
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)));
See Also
Categories
Find more on Text Files 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!