The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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 ]

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:

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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.