I want to read a text file having strings and numeric data

Dear Users,
I want to import the following file to matlab
Time: 0.10 Temp: 27.00 Acc: -0.79, 1.04, 6.57 Gyr: -0.01, -0.03, -0.01 Mag: 9.06, -20.79, -45.17 Quat: 0.47, -0.00, 0.01, 0.88 Euler: 123.4531, 0.3922, 0.8088
Time: 0.11 Temp: 27.00 Acc: -1.06, 1.45, 8.65 Gyr: 0.03, -0.06, -0.01 Mag: 9.06, -20.78, -44.88 Quat: 0.47, -0.00, 0.01, 0.88 Euler: 123.4531, 0.3922, 0.8088
which is the most appropriate solution?
thanks

 Accepted Answer

The two commands that are probably going to be the most useful for you are fscanf() and textscan().
However, if you have relatively new version of MATLAB (I think R2012b or later?), I would encourage you to try out the "Import Data" tool.

1 Comment

Hi cyclist!!
I have the version 7.1.0.246(R14) and the "Import data" creates a one cell.I dont know. if I use fscanf, as would be the format field??
Thanks for your answer

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!