hnng
Civil/Environmental
- Aug 17, 2007
- 38
I have a data set in a text file, this file was written by ANSYS and it does not allow me to customize the way in which this particular file is written. I am pasting a typical section here
ROW 1 NODE 224 DEG. OF. FR. = TEMP
1-0.26430952E+01 2 0.58435712E+00 3 0.00000000E+00 4 0.00000000E+00
5 0.00000000E+00 6 2.00000090E+00 7 0.50000000E+00 8 0.70000000E+00
10 1.23000000E+00
After opening the file I can read the first line starting with ROW using
C = textscan(fid,'%s %d %s %d %s %s %s %s %s',1);
I tried writing format for the first numeric row in which 1 is the serial number and -0.26430952E+01 is the value.
The problem is caused by entries which are have negative numbers. 1-0.26430952E+01 cannot be discerned using two %n as there is no space between them. The serial numbers are of fixed with 5, but if I ask it to read using %5c then also it reads '1-0.2' into the cell.
Can some one help me in getting this file properly imported into Matlab.
Thanks and Regards
ROW 1 NODE 224 DEG. OF. FR. = TEMP
1-0.26430952E+01 2 0.58435712E+00 3 0.00000000E+00 4 0.00000000E+00
5 0.00000000E+00 6 2.00000090E+00 7 0.50000000E+00 8 0.70000000E+00
10 1.23000000E+00
After opening the file I can read the first line starting with ROW using
C = textscan(fid,'%s %d %s %d %s %s %s %s %s',1);
I tried writing format for the first numeric row in which 1 is the serial number and -0.26430952E+01 is the value.
The problem is caused by entries which are have negative numbers. 1-0.26430952E+01 cannot be discerned using two %n as there is no space between them. The serial numbers are of fixed with 5, but if I ask it to read using %5c then also it reads '1-0.2' into the cell.
Can some one help me in getting this file properly imported into Matlab.
Thanks and Regards