ali
Posts:
6
Registered:
11/28/12
|
|
Re: text file data into matrix format
Posted:
Dec 18, 2012 12:01 AM
|
|
dpb <none@non.net> wrote in message <kancij$ge5$1@speranza.aioe.org>... > On 12/17/2012 1:07 AM, ali wrote: > > dpb <none@non.net> wrote in message <kaa90e$v58$1@speranza.aioe.org>... > ... > > >> > >> use a format string that matches... > >> > >> fmt=['x=%f, y=%f, z=%f']; > >> [x,y,z]=textread('yourfile.nam',fmt); > >> > ... > > > i have used the following codes > > > > b= importdata('new.txt'); > > c= b(2:2:end,:); > > n=strrep(c,'=',' ') > > c = textscan(n, '%s %f, %s %f, %s %f') > > > > > > new.txt file contains the following amount of strings: > > > > x=-115, y=-143, z= 449 > > x= -70, y= -29, z= 511 > ... > > x= 260, y= -83, z= 364 > > x= 248, y= -92, z= 230 > > but the textscan is not woriking. all i want to do is separating each x, > > y , z values in each columns so that i could make a graph. > > > > plz would you help. > ... > > Already did...sometimes the older tools are simpler/easier than the > newer-fangled ones...use textread() instead-- > > fmt=['x=%f, y=%f, z=%f']; > [x,y,z]=textread('new.txt',fmt); > > If you only want the even-numbered rows, _now_ do the decimation-- > > x(1:2:end,:)=[]; % etc., for others > > Or, of course, you can concatenate into a single array by > > data=[x y z]; > > and then use data(1,:), etc., for x... > > -- thanx, it works.
many many thanx
|
|