How to read only numerical values of serial output data in MATLAB?
2 次查看(过去 30 天)
显示 更早的评论
I just want to read the integer values (number) in the output text file (serial data)...... I need some assistance.....
0 个评论
采纳的回答
Walter Roberson
2021-11-8
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/791754/Log_file.txt';
data = readmatrix(filename, 'Range', 'C:C')
0 个评论
更多回答(2 个)
Yongjian Feng
2021-11-6
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)));
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Text Files 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!