Finding and using the value next to a specific word in a text file!
조회 수: 4 (최근 30일)
이전 댓글 표시
Hi everybody! I need to find the value of a specific variable printed in a MSC Nastran output file, which is not organized in a complete matrix. Although there isn't a unic organization, (only) the data rows of the file are organized in columns with a fixed width. The following is an extract of my file:
TRIM ALGORITHM USED: LINEAR TRIM SOLUTION WITHOUT REDUNDANT CONTROL SURFACES.
AEROELASTIC TRIM VARIABLES
ID LABEL TYPE TRIM STATUS VALUE OF UX
INTERCEPT RIGID BODY FIXED 1.000000E+00
1 ANGLEA RIGID BODY FREE 1.092527E-02 RADIANS
2 PITCH RIGID BODY FIXED 0.000000E+00 NONDIMEN. RATE
3 URDD3 RIGID BODY FIXED -9.810000E+00 LENGTH/S/S
For example, if i need to find the value associated to ANGLEA, i suppose to search the number of the row containing the string "ANGLEA (every spaces) RIGID BODY" (i'm including also the second column to avoid multiple results of searching), take it as string, and take from that string the components related to the value; for example:
val = numstr(93:104); % component from 93 to 104 of the string found in the search step
val =
1.092527E-02
Is it possible to obtain something like that? Or there are more efficient ways? thank you very much for your help!!!
댓글 수: 0
답변 (1개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Characters and Strings에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!