| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2205 人关注过本帖
标题:[讨论]如何从指定行提取数据存储读到另一文件?
只看楼主 加入收藏
anybody_szf
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-10-31
收藏
 问题点数:0 回复次数:2 
[讨论]如何从指定行提取数据存储读到另一文件?


请问我如何把如下a1.txt文件中的数据提取出来存到文件a2.txt中?
从“ STIFFNESS MATRIX FOR ELEMENT 1”之后的数开始。谢谢


***** SOLUTION DEBUG LEVELS= 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0

***** ANSYS SOLUTION ROUTINE *****

***** ANSYS SOLVE COMMAND *****

S O L U T I O N O P T I O N S

PROBLEM DIMENSIONALITY. . . . . . . . . . . . .3-D
DEGREES OF FREEDOM. . . . . . UX UY UZ
ANALYSIS TYPE . . . . . . . . . . . . . . . . .STATIC (STEADY-STATE)
GLOBALLY ASSEMBLED MATRIX . . . . . . . . . . .SYMMETRIC

*** NOTE *** CP = 13.406 TIME= 16:04:58
Present time 0 is less than or equal to the previous time.
Time will default to 1.

L O A D S T E P O P T I O N S

LOAD STEP NUMBER. . . . . . . . . . . . . . . . 1
TIME AT END OF THE LOAD STEP. . . . . . . . . . 1.0000
NUMBER OF SUBSTEPS. . . . . . . . . . . . . . . 1
STEP CHANGE BOUNDARY CONDITIONS . . . . . . . . NO
PRINT OUTPUT CONTROLS . . . . . . . . . . . . .NO PRINTOUT
DATABASE OUTPUT CONTROLS. . . . . . . . . . . .ALL DATA WRITTEN
FOR THE LAST SUBSTEP


SOLUTION MONITORING INFO IS WRITTEN TO FILE= gan2.mntr


THE BELOW ELEMENT MATRICES AND LOAD VECTORS ARE IN THE NODAL COORDINATE SYSTEMS.
GRAVITY AND TRANSIENT EFFECTS ARE INCLUDED.

STIFFNESS MATRIX FOR ELEMENT 1
1 0.6889000E+10 0.0000000E+00 0.0000000E+00 -0.6889000E+10 0.0000000E+00 0.0000000E+00
2 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
4 -0.6889000E+10 0.0000000E+00 0.0000000E+00 0.6889000E+10 0.0000000E+00 0.0000000E+00
5 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00

MASS MATRIX FOR ELEMENT 1
1 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00
2 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00
4 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00
5 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00

STIFFNESS MATRIX FOR ELEMENT 3
1 0.2435629E+10 0.2435629E+10 0.0000000E+00 -0.2435629E+10 -0.2435629E+10 0.0000000E+00
2 0.2435629E+10 0.2435629E+10 0.0000000E+00 -0.2435629E+10 -0.2435629E+10 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
4 -0.2435629E+10 -0.2435629E+10 0.0000000E+00 0.2435629E+10 0.2435629E+10 0.0000000E+00
5 -0.2435629E+10 -0.2435629E+10 0.0000000E+00 0.2435629E+10 0.2435629E+10 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00

MASS MATRIX FOR ELEMENT 3
1 0.1178511E+01 0.0000000E+00 0.0000000E+00 0.5892557E+00 0.0000000E+00 0.0000000E+00
2 0.0000000E+00 0.1178511E+01 0.0000000E+00 0.0000000E+00 0.5892557E+00 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.1178511E+01 0.0000000E+00 0.0000000E+00 0.5892557E+00
4 0.5892557E+00 0.0000000E+00 0.0000000E+00 0.1178511E+01 0.0000000E+00 0.0000000E+00
5 0.0000000E+00 0.5892557E+00 0.0000000E+00 0.0000000E+00 0.1178511E+01 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.5892557E+00 0.0000000E+00 0.0000000E+00 0.1178511E+01

STIFFNESS MATRIX FOR ELEMENT 2
1 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
2 0.0000000E+00 0.6889000E+10 0.0000000E+00 0.0000000E+00 -0.6889000E+10 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
4 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00
5 0.0000000E+00 -0.6889000E+10 0.0000000E+00 0.0000000E+00 0.6889000E+10 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00 0.0000000E+00

MASS MATRIX FOR ELEMENT 2
1 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00
2 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00
3 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00 0.4166667E+00
4 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00 0.0000000E+00
5 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00 0.0000000E+00
6 0.0000000E+00 0.0000000E+00 0.4166667E+00 0.0000000E+00 0.0000000E+00 0.8333333E+00

**** CENTER OF MASS, MASS, AND MASS MOMENTS OF INERTIA ****

CALCULATIONS ASSUME ELEMENT MASS AT ELEMENT CENTROID

TOTAL MASS = 8.5355

MOM. OF INERTIA MOM. OF INERTIA
CENTER OF MASS ABOUT ORIGIN ABOUT CENTER OF MASS

XC = 0.64645E-01 IXX = 0.1509E-01 IXX = 0.4419E-02
YC = 0.35355E-01 IYY = 0.4009E-01 IYY = 0.4419E-02
ZC = 0.0000 IZZ = 0.5518E-01 IZZ = 0.8839E-02
IXY = -0.2134E-01 IXY = -0.1831E-02
IYZ = 0.000 IYZ = 0.000
IZX = 0.000 IZX = 0.000


*** MASS SUMMARY BY ELEMENT TYPE ***

TYPE MASS
1 8.53553

Range of element maximum matrix coefficients in global coordinates
Maximum= 6.889E+09 at element 2.
Minimum= 2.435629308E+09 at element 3.

*** ELEMENT MATRIX FORMULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP

1 3 LINK8 0.000 0.000000
Time at end of element matrix formulation CP= 13.921875.

SPARSE MATRIX DIRECT SOLVER.
Number of equations = 2, Maximum wavefront = 1
Memory available for solver = 38.15 MB
Memory required for in-core = 0.00 MB
Optimal memory required for out-of-core = 0.00 MB
Minimum memory required for out-of-core = 0.00 MB
curEqn= 1 totEqn= 2 Job CP sec= 1460.890
Factor Done= 25% Factor Wall sec= 0.000 rate= 0.0 Mflops

*** ELEMENT RESULT CALCULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP

1 3 LINK8 0.000 0.000000

*** NODAL LOAD CALCULATION TIMES
TYPE NUMBER ENAME TOTAL CP AVE CP

1 3 LINK8 0.000 0.000000
*** LOAD STEP 1 SUBSTEP 1 COMPLETED. CUM ITER = 1
*** TIME = 1.00000 TIME INC = 1.00000 NEW TRIANG MATRIX

*** NOTE *** CP = 13.953 TIME= 16:04:59
Solution is done!


*** ANSYS BINARY FILE STATISTICS
BUFFER SIZE USED= 16384
0.063 MB WRITTEN ON ELEMENT MATRIX FILE: gan2.emat
0.063 MB WRITTEN ON ELEMENT SAVED DATA FILE: gan2.esav
0.063 MB WRITTEN ON ASSEMBLED MATRIX FILE: gan2.full
0.063 MB WRITTEN ON RESULTS FILE: gan2.rst

FINISH SOLUTION PROCESSING


***** ROUTINE COMPLETED ***** CP = 14.094

*** NOTE *** CP = 14.094 TIME= 16:04:59
A total of 34 warnings and errors written to e:\Documents and
Settings\szf\file.err.

[此贴子已经被作者于2007-11-1 9:42:38编辑过]

搜索更多相关主题的帖子: 数据存储 文件 SOLUTION STIFFNESS ANSYS 
2007-11-01 09:40
anybody_szf
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-10-31
收藏
得分:0 
为什么我用下面的程序不行,麻烦各位高手给看一下,错在那里。
matlab中如何读取TXT数据文件中指定行的数据?
下面这个函数是取filein中的第line行写入fileout中的程序,如果想实现取特定几行,只要稍微修改一下就可以。
function dataout=dataread(filein,fileout,line)
fidin=fopen(filein,'r');
fidout=fopen(fileout,'w');
nline=0;
while ~feof(fidin) % 判断是否为文件末尾
tline=fgetl(fidin); % 从文件读行
nline=nline+1;
if nline==line
fprintf(fidout,'%s\n',tline);
dataout=tline;
end
end
fclose(fidin);
fclose(fidout);
调用格式:dataout=dataread(filein,fileout,line)

2007-11-01 09:41
anybody_szf
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2007-10-31
收藏
得分:0 

自己顶一下


2007-11-01 18:50
快速回复:[讨论]如何从指定行提取数据存储读到另一文件?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.061517 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved