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 ]
Nasser Abbasi

Posts: 5,606
Registered: 2/7/05
Re: text file data into matrix format
Posted: Nov 28, 2012 3:57 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

On 11/28/2012 2:37 AM, ali wrote:
> hi
>
> i am a beginner in Matlab. i am just stuck in part of my project. i have a
>text file which has the following format data.
>
>
> x= 71, y= 7, z= 228
>
> x= 70, y= 5, z= 228
>
> x= 71, y= 5, z= 227
>
> x= 71, y= 6, z= 230
>
> x= 71, y= 6, z= 228
>
> x= 71, y= 7, z= 228
>
>
> i want make a graph for each axis. for that i have to make a column matrix for x, y and z.


There is nothing really called 'column matrix`. It is called just a matrix.

>
> i don't from where to start.
>
> plz any kind of code help would be a great for me.


If you can change the program or function that was used to generate
the output above so that it writes the output in simpler way,
like this

71 7 228
70 5 228

etc...

it will be easier to read again

But in either case, you need to read the file into a matrix.
For the format you show up, you can use textscan with the
appropriate format specifier.

If the data was in the simpler form I show up, you can just
read it much easier using one command such as
importdata()

http://www.mathworks.com/help/matlab/import_export/import-numeric-data-and-header-text-from-a-text-file.html

--Nasser




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.