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: Extract numbers from table containing text and numbers
Replies: 29   Last Post: Feb 7, 2013 5:59 PM

Advanced Search

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

Posts: 8,152
Registered: 6/7/07
Re: Extract numbers from table containing text and numbers
Posted: Feb 1, 2013 1:44 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 1/31/2013 8:40 PM, Stan wrote:
> Hello,
>
> I am trying to extract 2 columns from a file with 425 header lines and
> then the following:
>
> Q (upper-edge --0.1250E-03 AmP )= 0.98880E-02+- 0.28300E-03
> units/alpha/round
> Q (upper-edge --0.2500E-03 AmP )= 0.19648E-01+- 0.39412E-03

...

> Here is my attempt, using textscan, and the output I am getting:
>

...

>>> fmt1=[' %s' '%s' '%s%s%f' '%s' '%s' ' %f%s%s' ' %f' '%s'];
>>> set_m=textscan(fid1, fmt1,'delimiter','
>>> ','headerlines',425,'CollectOutput',true); %skip 425 header lines and

...
> I need the 3 columns that contain the numbers. Only the first 4 columns
> seem to be working. Is there something that I am missing, in the
> formatting, for the remaining columns?


Yeah, the numbers are ill-formed w/ the doubled signs methinks...since
you have a fixed format I'd use string-matching...

I cut'n pasted a sample line into a cell string and at the command line
get...

>> textscan(d{1},'Q (upper-edge -%f AmP )= %f+- %f %*s')
ans =
[-1.2500e-04] [0.0099] [2.8300e-04]
>>

Salt to suit...

--



Date Subject Author
1/31/13
Read Extract numbers from table containing text and numbers
Stan
1/31/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/1/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/1/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/1/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/2/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/2/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/2/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/2/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/2/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/2/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/3/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/3/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/4/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/4/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/4/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/5/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/5/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/5/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/5/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/5/13
Read Re: Extract numbers from table containing text and numbers
dpb
2/3/13
Read Re: Extract numbers from table containing text and numbers
Stan
2/3/13
Read Re: Extract numbers from table containing text and numbers
Bruno Luong
2/7/13
Read Re: Extract numbers from table containing text and numbers
Stan

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.