From: Walter Roberson on 13 Jul 2010 00:22 Heman wrote: > Well I am sorry but this portion didnt have th error value generated > yet. If i have to paste the error. Anyways, I could some how mange > through unix in separating the error values into a text file. Or you could call perl from within Matlab. > My next question is my new text file has just the column values in > hexadecimal. and i want to use all these 1024 values to plot vs time. textscan() and fscanf() support %x formats.
From: Wayne King on 13 Jul 2010 03:11 "Heman " <kokahemant(a)hotmail.com> wrote in message <i1gfqb$3h6$1(a)fred.mathworks.com>... > "Heman " <kokahemant(a)hotmail.com> wrote in message <i1gf3u$kp3$1(a)fred.mathworks.com>... > > Hi all, > > > > I have a text file which is a output file form another tool consisting of various x,y,z values run over some 650,000+ iterations. > > > > Now i need to use this text file as input to the Matlab and read only values of z and plot a graph. > > > > Can some one tell me how can we do it? It would be great if a sample code could be given. > > > > Thank you > > I am sorry guys.. I dont know how this got posted 3 times. I am trying to delete the other 2 repetitive posts but am not able to figure out how. > > Sorry for the trouble. > > Thank you Hi Heman, I think you should give us more detail on what your text file looks like. In other words, is there any header information in your text file, or does it simply consist of 3 columns of numbers. Are the columns separated by commas, etc.? If the file simply consists of three columns of numbers, then have you tried using load filename.txt -ascii For example, if you enter x = randn(10,3) and copy and paste the numeric output (not the x = ) into a text file called testfile.txt. Then you can enter: load testfile.txt -ascii plot(testfile(:,3)); To plot the Z-values (assumed here to be the 3rd column). If the structure of the text file is more sophisticated, look at the documentation for textscan >>doc textscan Wayne
From: B. Schmidt on 13 Jul 2010 15:49 "Heman " <kokahemant(a)hotmail.com> wrote in message <i1gf3u$kr9$1(a)fred.mathworks.com>... > Hi all, > > I have a text file which is a output file form another tool consisting of various x,y,z values run over some 650,000+ iterations. > > Now i need to use this text file as input to the Matlab and read only values of z and plot a graph. > > Can some one tell me how can we do it? It would be great if a sample code could be given. > > Thank you I have used two methods to read text files into MATLAB. Examples are as follows: %browse to text file [filename filepath] = uigetfile({'*.txt'}); FileLocation = [filepath filename]; formatstring = '%s %n %n'; delimstring = ','; [x y z] = textread(FileLocation,formatstring'delimiter',delimstring); or %browse to text file [filename filepath] = uigetfile({'*.txt'}); FileLocation = [filepath filename]; % open the file for reading only and create a file ID fid1 = fopen(FileLocation,'r'); formatstring = '%s %n %n'; delimstring = '\t'; % read data FileContent = textscan(fid1,formatstring,'BufSize',32768,'Delimiter',delimstring); for more info look up textscan or textread functions in MATLAB help. Of course the formatstring and delimstring will depend on the data type of your data and the delimeter of the text file. I would suggest reading all your data (x,y and z) into Matlab and then extracting only the z values after the read operation.
From: Heman on 15 Jul 2010 19:35 "Heman " <kokahemant(a)hotmail.com> wrote in message <i1gf3u$kp3$1(a)fred.mathworks.com>... > Hi all, > > I have a text file which is a output file form another tool consisting of various x,y,z values run over some 650,000+ iterations. > > Now i need to use this text file as input to the Matlab and read only values of z and plot a graph. > > Can some one tell me how can we do it? It would be great if a sample code could be given. > > Thank you Hi all, I have reolved it. Thanks to every1. I could create the matlab code and plot the text file. I was actually reading hex values form the text and was using fread rather than fscanf. Thank you
First
|
Prev
|
Pages: 1 2 Prev: need help with matlab plot Next: OuterPosition in absolute units and plotyy |