필터 지우기
필터 지우기

Text files data extract

조회 수: 1 (최근 30일)
RAKESH KUMAR TOTA
RAKESH KUMAR TOTA 2021년 1월 26일
답변: Rashed Mohammed 2021년 1월 29일
Good morning ,
I have a large text file .Ihere by attached text file. I want to extract Nodal displacements of 4961 nodes (1 displ 2 displ)and keep it in matrix format. Any help would be appreciated. Thank you in advance.

채택된 답변

Rashed Mohammed
Rashed Mohammed 2021년 1월 29일
Hi Rakesh,
You can skip the lines above the data while reading the txt file. The following code worked for me for extracting the node displacement values.
fileID = fopen('Onefwp.txt');
nodes = cell2mat(textscan(fileID,'%f %f %f %f %f','HeaderLines',11096));
fclose(fileID);
If you run the above code, the nodes variable will be a 4961x5 matrix, with 1st column representing the node id and 4th and 5th column representing the displacement values.
Hope this helps!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by