Input files editing format

1 次查看(过去 30 天)
Hi, Good morning
I have an input file input.txt, i need to save the format in different two files node.txt and el.txt in the format attached files. Any help would be appreciated . Thank you inadvance.
  2 个评论
Mario Malic
Mario Malic 2021-1-18
What is the actual question here?
RAKESH KUMAR TOTA
RAKESH KUMAR TOTA 2021-1-18
i need to extract data from input.txt file ( nodes and element data) and save in the format node.txt and el.txt as mentioned in the uploaded files. Thank you.

请先登录,再进行评论。

采纳的回答

Walter Roberson
Walter Roberson 2021-1-18
fid = fopen('input.txt', 'r');
nodedata = cell2mat( textscan(fid, '%*f,%f,%f', 'CommentStyle', {'*Heading', '*Node'}) );
eldata = cell2mat( textscan(fid, '%*f,%f,%f,%f,%f', 'HeaderLines', 1) );
fclose(fid)
  8 个评论
RAKESH KUMAR TOTA
RAKESH KUMAR TOTA 2021-1-18
Thanks a lot . It really saved a lot of time.
RAKESH KUMAR TOTA
RAKESH KUMAR TOTA 2021-1-18
eldata (:, 1) = 1; % why ??? ... I need to assign materail no.1 to all elements in my code. Thank you

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import and Export 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by