
Re: text file data into matrix format
Posted:
Nov 28, 2012 3:57 AM


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/importnumericdataandheadertextfromatextfile.html
Nasser

