From: John on 26 Jul 2010 17:40 I have a txt file that is of unknown column/row length or size. Similar to this: Title1 Title2 Title3 ... 1 2 3 1 2 3 1 2 3 ....you get the point. It is basically a /t delimited txt file exactly like a excel sheet. How do I use the textread function similar to the [file, text] = xlsread(). Is that possible? Thanks, Clay
From: Walter Roberson on 26 Jul 2010 18:01 John wrote: > I have a txt file that is of unknown column/row length or size. Similar > to this: > > Title1 Title2 Title3 ... > 1 2 3 > 1 2 3 1 2 3 > > ...you get the point. It is basically a /t delimited txt file exactly > like a excel sheet. How do I use the textread function similar to the > [file, text] = xlsread(). Is that possible? It probably is not possible with textread() unless you don't mind all of the data being pushed together into one continuous vector. My approach would probably be to fopen() the file, fgetl() to read the header line, ftell() to record the current position, fgetl() to read the first line of data, then numcols = 1 + sum(InputLine == sprintf('\t')); then fseek() back to the remembered position, then textscan(fid, repmat('%f', 1, numcols), 'Delimiter', '\t', 'CollectOutput', 1) then fclose()
|
Pages: 1 Prev: core 2 duo XPC target video not working Next: fgoalattain (Optimization Toolbox) |