extract numbers from text file
Show older comments
Hello, I have a text file that contains a series of lines as following form, but I only need the number data here, so how can I just read/import numbers from TXT files?
sub_name sub_id gender RT keypress cond
wangweiliang 103 1 9.138582e+00 4 5
wangweiliang 103 1 3.183194e+00 8 2
wangweiliang 103 1 2.689366e+00 1 1
wangweiliang 103 1 4.470684e+00 9 8
wangweiliang 103 1 3.016167e+00 4 4
wangweiliang 103 1 4.793164e+00 3 3
wangweiliang 103 1 2.943291e+00 1 6
wangweiliang 103 1 2.798679e+00 3 7
Answers (1)
T = readtable("data.txt");
T=T(:, 2:end)
x = table2array(T)
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!