textscan

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

textscan

justinmoreno
I am trying to read in data from a text file using textscan. Ideally, I would
have 9 columns of data however the 9th column contains a string of
characters which could at times include whitespace and other unknown
characters. Here is a sample of the data and the code I am using  test.txt
<http://octave.1599824.n4.nabble.com/file/t372589/test.txt>  

filename = 'test.txt'

fid = fopen(filename,'r')

data = textscan(fid,'%s %s %s %s %s %s %s %s %s %s','HeaderLines',7)

I tried to use a carriage return to exclude the 9th column as a first pass
but I can't seem to get it to work.

Thanks



--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: textscan

justinmoreno
After some more research using %*[^\n] allows you to skip the remainder of
the line which solves the problem.




--
Sent from: http://octave.1599824.n4.nabble.com/Octave-General-f1599825.html

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave