|
Prev: How to implement 1 -Nearest Neighbor method plz tell me urgenttt
Next: how to input video from a webcam to a simulink model in R14 SP3
From: Erik Andersson on 6 May 2008 09:36 Hello! I'got a problem reading my .txt file which looks like this: 20070830 1840 3.79 2.87 271.40 20070830 1850 6.40 0.42 269.90 20070830 1900 6.56 0.51 269.90 I've tried textread('test.txt','%d%d%f%f%f',' '). What do I have to change to make it work?
From: Bob on 6 May 2008 10:11 Does this help? [yyyymmdd,hhmm,x1,x2,x3] = textread('test.txt','%d %d %f %f %f'); Cheers Bob
From: Erik Andersson on 6 May 2008 10:24 Bob <rbemis(a)mathworks.com> wrote in message <46e1b4d8-033b- 46d2-8d20-c0757fc5992c(a)x35g2000hsb.googlegroups.com>... > Does this help? > > [yyyymmdd,hhmm,x1,x2,x3] = textread('test.txt','%d %d %f %f %f'); > > Cheers > Bob It still doesn't work, i get the following error: ??? Trouble reading integer from file (row 2, field 2) ==> .87 271.40\n Error in ==> textread at 176 [varargout{1:nlhs}]=dataread('file',varargin{:}); Error in ==> importeradata at 2 [yyyymmdd,hhmm,x1,x2,x3] = textread('test.txt','%d %d %f %f %f'); What does this mean and what should be corrected??
From: Erik Andersson on 6 May 2008 10:37 I got it to work now, thanks!
From: Erik Andersson on 6 May 2008 10:40
Is it possible to get the outcome as a matrix where the colums are V=[year time x1 x2 x3]. Now I just get seperate vectors. If I put the togheter as a matrix as defined above a get the following: V = 1.0e+007 * 2.0071 0.0002 0.0000 0.0000 0.0000 2.0071 0.0002 0.0000 0.0000 0.0000 2.0071 0.0002 0.0000 0.0000 0.0000 2.0071 0.0002 0.0000 0.0000 0.0000 |