This should work for any number of columns and it automatically detects the number of header rows and the variable names.
t = readtable('text.txt')
data = table2array(t); % convert to a plain numeric array
whos data
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!