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: Problems with textscan reading formatted text
Replies: 1   Last Post: Mar 19, 2014 7:50 PM

Advanced Search

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

Posts: 1
Registered: 3/19/14
Problems with textscan reading formatted text
Posted: Mar 19, 2014 5:57 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

I am trying to use textscan to read the following line from a textfile where I only want a subset of the text. The file looks like:

header line
header line
1 pixel = 0.0106
Lens information can be found in Charlotte's lab notebook: book 1 page 15.
other data

I want to store the numbers 1 and 15 from line 4.

My code is:

filepath='140304_1_C.txt';
fid=fopen(filepath,'r');
textscan(fid,'%s',2,'delimiter','\n');
pixelsize = textscan(fid,'1 pix = %7.5f %*[^\n]');
info = textscan(fid,'Lens information can be found in Charlotte''s lab notebook book: %f %s %f %*[^\n]');

This is not working. info returns [] [] [].

I am a novice with Matlab. Any help with this is much appreciated.



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.