Convert a text file to a matrix
Show older comments
Hello.
I have a text file with columns delimited by tabs. I have to convert it to a matrix. I have the following problems :
- sometimes, there is two or more tabs in a row. It means that there is a blank cell.
- sometime, two words are seperated by a point. When this happens, it doesn't mean that they are in different cells! Only the "tab" is a delimiter.
- the collumns and lines are not always the same lenght.
Exemple of one line :
00982 FILE 2 Dupont Mary, May FEMALE 23.04.1999 0 89 11 23 2.01.2017 14:02:30 168 55 19.49 128 LABHUTC Yes 789 123 8 5 2 4 3
At first, I tried to use "strsplit(U)" but because of the problems I enonced, it doesn't work.
Oh and when I copy and paste the text file in excel, it gives me the right table.
Thank you very much in advance!
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!