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: Using textscan function properly
Replies: 6   Last Post: Jan 15, 2012 2:13 PM

Advanced Search

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

Posts: 40
Registered: 1/22/11
Re: Using textscan function properly
Posted: Jan 15, 2012 5:54 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On Jan 13, 4:03 pm, "Pekka Kumpulainen"
<pekka.nospam.kumpulai...@tut.please.fi> wrote:
> maxwell10 <avrial...@gmail.com> wrote in message <d6c4acc0-56cc-4c56-9afb-83438206e...@j9g2000vby.googlegroups.com>...
> > On Jan 13, 10:39 am,AvriAlony <avrial...@gmail.com> wrote:
> > > I have xml files which contain the follows lines:
> > >     <I x="12508.2645"    y="0.0425" />
> > >     <I x="12509.04"        y="0.072928" />
> > >     <I x="12509.8"          y="0.06485" />
> > >     <I x="12510.63909"   y="0.078086" />
> > > ... etc
> > > I would like to generate two matrix X and Y that will contain the
> > > values.
> > >  i.e: X = [12508.2645 ; 12509.04 ; 12509.8 ; 12510.63909]
> > > and Y = [0.0425 ;        0.072928 ; 0.06485 ; 0.078086]

>
> > > Is it possible to do so without the use of for loop?
>
> > > One more problem is the fact that the files contains header.
>
> > > Thanks
>
> > I success to generate two matrix X and Y without the use of for loop:
> > C = textscan(fid,'%s %f %s %f %s', 'delimiter','"');
> > X = C{2}; A = Y{4};
> > I still need to overcome the header problem.

>
> If the header is afixed number of lines in the beginning of the file you can skip them with the parameter ...'HeaderLines',


the problem is that the number of line could be change. but the string
<\EndOfHeader> is writen in the end of the header.
I tried to use:
textscan(fid,'%s','delimiter','<\EndOfHeader>');
but the delimiter is not by all whole string '<\EndOfHeader>' as I was
expected but it delimiter between the content of the string.
i.e: textscan(fid,'%s','delimiter','abc'); delimiter between 'a' or
'b' or 'c'.

How can I force it to delimiter between the whole string?



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.