Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
alex
Posts:
4
Registered:
7/15/05
|
|
extracting data from text file
Posted:
Jan 6, 2013 9:03 PM
|
|
I want to extract data from a text file. The file looks like +++++++++++++++++++++++ headerlines 1 to 6-unwanted
data lines 1 and 2-unwanted 900; (0d 0h 15m 0s); 0; (0d 0h 0m 0s); 0; (0d 0h 0m 0s); 0; (0d 0h 0m 0s); 0; (0d 0h 0m 0s); 0; ; 0; ; 0.00E0; ; 0.00E0; ; 0.00E0; ; 0.00E0; ; 0.00E0; ; 0.00E0; ; -63.40; ; -61.80; ; -62.47; ; 17.90; ; -100.00; ; -- ; -- ; -- ; -- ; -- ; -- ; -- ; -- ; ++++++++++++++++++++++++++++++++++++
the last line starts with 900 and its a single line all the way. I am trying to extract and plot separate column from the last line which has numeric value,e.g- 63.40; ; -61.80; ; -62.47; ; 17.90; ; -100.00;
my code looks like
fileID = fopen('sample1.txt'); mydata = textscan(fileID,'%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %d %d %d %d %d %s %s %s %s %s %s %s', 'headerlines',9,';','treatAsEmpty', '--'); fclose(fid);
%which gives and error->>> ??? Error using ==> textscan Param/value pairs must come in pairs.
Any help would be greatly appriciated.:) Thanks PK
|
|
|
|