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: text file data into matrix format
Replies: 10   Last Post: Dec 18, 2012 12:01 AM

Advanced Search

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

Posts: 6
Registered: 11/28/12
Re: text file data into matrix format
Posted: Dec 12, 2012 2:08 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Nasser M. Abbasi" wrote in message <ka6kji$1uv$1@speranza.aioe.org>...
> On 12/10/2012 11:48 PM, ali wrote:
>

> >
> > as per your instruction i have written in following way:
> >
> > fid = fopen('new1.txt'); % the file name is new1.txt which contains 1971X1 cell
> > mydata = textscan(fid, '%s %f, %s %f, %s %f');
> > fclose(fid);
> >
> > but my data shows only for 450X1. i just can't understand why. but
> >the data for x, y, z is extracted and showed in matrix form. but
> >the problem is they are not showing all the data.
> >

>
> are you saying it is read only 450 lines from the file, while the
> file contains 1971 lines? humm... may be you can look at
> line 451 in the textfile and see if has anything weired in it.
>
> I tried this on my matlab 2012a for 3 lines, and everything worked
> ok. I do not know why it stopped at line 450. If you post your textfile
> somewhere may be you'll get better help.
>
>
> ---foo.txt-----------
> x= 71, y= 7, z= 228
> x= 70, y= 5, z= 228
> x= 71, y= 5, z= 227
> ----------------------
>
> EDU>> fid = fopen('foo.txt');
> EDU>> mydata = textscan(fid, '%s %f, %s %f, %s %f');
> EDU>> mydata{:}
>
> ans =
> 'x='
> 'x='
> 'x='
>
> ans =
> 71
> 70
> 71
>
> ans =
> 'y='
> 'y='
> 'y='
>
> ans =
> 7
> 5
> 5
>
> ans =
> 'z='
> 'z='
> 'z='
>
> ans =
> 228
> 228
> 227
>
>
> --Nasser



Dear Nasser

thanx for helping me

i have uploaded the file here.
http://www.mediafire.com/view/?dd4mdib53jl8dhw

plz check the file

thank you



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.