Hello, I have a text file that contains one column of words. I would like to read in the file as a string array of seperated strings so I can index the elements in the array.
Any advice is greatly appecraiated! Thanks!
Best Answer
fileName = '<your full file path here>'
% my sample text contains ---> apple, baseball, car, donut, & elephant in single column.
Did you open the file with 'rt' instead of 'r' in order to account for the CRLF ?
Also note that if you use a count for textscan() then the file position will be left after the last format code is used,before the newline for that line (unless the end of format matches newline)
Best Answer