why the only first row of the imported data using importdata is not correct

8 views (last 30 days)
I have following data copied from excel file and then pasted to a file "x.txt":
USName Height Width Thickness Area
- - - - in^2
L1x1x1/8 1 1 0.125 0.234375
then I use following commands to load the file
S = importdata('x.txt','\t');
and then check S.textdata and I got:
[1x34 char] [] [] [] []
'-' '-' '-' '-' 'in^2'
'L1x1x1/8' '' '' '' ''
Why the first row is not parsed? as
'USName' 'Height' 'Width' 'Thickness' 'Area'
I have another data in which I did the same but I got the correct info with following operations. Just do not understand why.
Please help. Thanks...

Answers (1)

J. Hu
J. Hu on 3 Apr 2013
If I switch the first and second row as:
- - - - in^2
USName Height Width Thickness Area
L1x1x1/8 1 1 0.125 0.234375
I got:
'- - - - in^2' [] [] [] []
'USName' 'Height' 'Width' 'Thickness' 'Area'
'L1x1x1/8' '' '' '' ''
Still, the only the first row not parsed correct. Why? Thanks...

Tags

Community Treasure Hunt

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

Start Hunting!