Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: extracting data from text file
Replies: 2   Last Post: Jan 7, 2013 10:09 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
alex

Posts: 4
Registered: 7/15/05
extracting data from text file
Posted: Jan 6, 2013 9:03 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.