From: Raj Dabholkar on 12 Jul 2010 07:23 I have quite a complicated output file that cannot be made any simpler. The problem is I need to extract the X, Y and Z co-ordinates from the file for a group of points and store them in an array The number of points varies from file to file. A sample of the data file is shown below. Can someone PLEASE help me?! -------------------------------------------------------------------------------- 09-Jul-2010 13:31 Start Template Page 1 -------------------------------------------------------------------------------- (mm) ACTUAL NOMINAL LO-TOL HI-TOL DEVIATION GRAPHIC ERROR -------------------------------------------------------------------------------- Temperature Compensation: OFF Point:PNT001 X-axis -70.5236 -70.5030 -0.1000 +0.1000 -0.0206 --*+--- Y-axis 23.7369 23.7407 -0.1000 +0.1000 -0.0038 ---*--- Z-axis 1.2001 0.0000 -0.1000 +0.1000 1.2001 ---+--> 1.1001 -------------------------------------------------------------------------------- Point:PNT002 X-axis -54.4541 -54.4644 -0.1000 +0.1000 0.0103 ---*--- Y-axis 23.7413 23.7407 -0.1000 +0.1000 0.0006 ---*--- Z-axis 1.0726 0.0000 -0.1000 +0.1000 1.0726 ---+--> 0.9726 -------------------------------------------------------------------------------- Point:PNT003 X-axis -38.4163 -38.4258 -0.1000 +0.1000 0.0095 ---*--- Y-axis 23.7411 23.7407 -0.1000 +0.1000 0.0004 ---*--- Z-axis 1.0081 0.0000 -0.1000 +0.1000 1.0081 ---+--> 0.9081 -------------------------------------------------------------------------------- Point:PNT004 X-axis -22.3803 -22.3872 -0.1000 +0.1000 0.0069 ---*--- Y-axis 23.7421 23.7407 -0.1000 +0.1000 0.0014 ---*--- Z-axis 1.0056 0.0000 -0.1000 +0.1000 1.0056 ---+--> 0.9056 -------------------------------------------------------------------------------- Point:PNT005 X-axis -6.3599 -6.3487 -0.1000 +0.1000 -0.0112 ---*--- Y-axis 23.7438 23.7407 -0.1000 +0.1000 0.0031 ---*--- Z-axis 1.0381 0.0000 -0.1000 +0.1000 1.0381 ---+--> 0.9381 -------------------------------------------------------------------------------- Point:PNT006 X-axis -6.3435 -6.3487 -0.1000 +0.1000 0.0052 ---*--- Y-axis 41.0261 41.0234 -0.1000 +0.1000 0.0027 ---*--- Z-axis 0.9081 0.0000 -0.1000 +0.1000 0.9081 ---+--> 0.8081 --------------------------------------------------------------------------------
From: Ashish Uthama on 12 Jul 2010 08:29 One possible template solution: (look at help/doc for the capitalized functions) fid = FOPEN xInd=1,yInd=1,ZInd=1; xData={},yData={}, zData={}; while(file has more data (FEOF)) oneline = FGETL(fid) if(oneline[1] matches X) use x = TEXTSCAN(online,...) syntax to extract required number xData{xInd} = x; xInd=xInd+1; elseif(oneline[1] matches Y) ... elseif(oneline[1] matches Z) ... end end CELL2MAT to convert the cell array xData to a matric. .... .... post back if you have more questions while trying to implement this.
From: David on 27 Jul 2010 10:37 Thanks Ashish. Been trying to get something like this to work all day :)
|
Pages: 1 Prev: plotting log scale Next: feval error message when opening a GUI |