MATLAB: Import text files with character and numeric data

data importtext file

Hello, I have the following text file (please find attached). I want to import it into matlab and I need only numeric data. The text is not required. I tried this using the import function in matlab. The problem I have is the number of columns are not known and keeps on changing. So the generated code is not working when the number of columns change. How can I import the data with any number of columns and rows. Moreover, the data file I attached is a smaller version. The number of rows in original data file goes over 3 million. How can I import the text file of this type as fast as possible ?
Thank you.

Best Answer

s=importdata('file.txt')
data=s.data
text=s.textdata
colheaders=s.colheaders