readtable : set up the multiple lines of variables

3 views (last 30 days)
This is my data. The problem appeared at the following image. From the second column, it does not work.
I commanded,
filename = 'A001.txt';
data = readtable(filename,'NumHeaderLines',0,'VariableNamingRule','preserve');

Accepted Answer

Walter Roberson
Walter Roberson on 12 Oct 2021
filename = 'https://www.mathworks.com/matlabcentral/answers/uploaded_files/760511/A001.txt';
opt = detectImportOptions(filename, 'VariableNamingRule','preserve');
opt.VariableNamesLine = 1;
data = readtable(filename, opt);
data(1:2,1:10)
ans = 2×10 table
Date Timestamp Event_Log Trial Count Starting_Point_Pos_x Starting_Point_Pos_y Starting_Point_Pos_z Target_Point_Pos_x Target_Point_Pos_y Target_Point_Pos_z __________ _________ __________ ___________ ____________________ ____________________ ____________________ __________________ __________________ __________________ 2.0211e+13 3.0136 {0×0 char} 0 -0.1446 0.9182 0.4343 0 0 0 2.0211e+13 3.0245 {0×0 char} 0 -0.1446 0.9182 0.4343 0 0 0
  3 Comments

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!