"Nasser M. Abbasi" wrote in message <email@example.com>... > 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
Thank you nasser
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.