MATLAB Answers

HD
0

readtable is jumping to a new row after delimiter

Asked by HD
on 18 Jan 2019
Latest activity Answered by madhan ravi
on 18 Jan 2019
Hi, I am using readtabe to read a dat file.
i am using Data = readtable(fullfile(filepath,filename);
it should read
'my first line is this'
'my second line is different'
'my third line is a measurment = 1' etc.
instead it is reading
'my'
'first'
'line' etc ...
I don't understand why especilly it was working properly this morning.
I tried adding, 'delimiter', 'space but gave the same result.
Any idea why and how to solve it?
thank you

  0 Comments

Sign in to comment.

2 Answers

Answer by Cris LaPierre on 18 Jan 2019
Edited by Cris LaPierre on 18 Jan 2019
 Accepted Answer

A delimiter is what indicates where to separate words. It seems the delimiter is already a space, as you are already getting the output to be one word at a time. It's hard to say what you should use instead, since we'd need to see the actual data file.
In the meantime, try using the Import Tool to see if using the user interface you can get the desired output. That might help you see what settings to use for readtable.

  0 Comments

Sign in to comment.


Answer by madhan ravi
on 18 Jan 2019

readtable('sample.txt','delimiter','\n','ReadVariableNames',0)

  0 Comments

Sign in to comment.