import from .dat file abaqus
Mostrar comentarios más antiguos
hi all,
I try to import certain lines from my .dat file, generated from abaqus. However something strange happens. When I try to import the certain lines with use of Import Data button, select my lines and import it as a table and write it as a function 'importfile'. Then It's not importing the lines I want, but an arbitrary selection, even though the corresponding rows match. However if I copy and paste data from my abaqus generated .dat file, to an empty .dat file, open that one in matlab and select the lines I want to import, then it dóes import the correct lines.
Anyone a clue what is happening here? I tried almost all features in the Import Data toolbox, such as writing it as a different file (table, cell, etc.) but nothing works so far. The file is pretty large, can there be a problem?
I uploaded the file, I need the following data points, for every increment I need the values on the column below the PU2 and the frequency. Is someone keen to help me out? :)
NODE FOOT- U1 U2 PU1 PU2
NOTE
3739 9.4520527E-02 -1.9431870E+00 9.5103755E-02 1.9543827E+00
3739 SSD 1.0516381E-02 -2.0889238E-01 6.3486346E+00 -1.7386427E+02
INCREMENT NUMBER 31
FREQUENCY = 78.976194
5 comentarios
Mario Malic
el 20 de Oct. de 2020
Counter = 1;
FID = fopen('results.txt', 'rt');
tline = fgetl(FID);
File_Data{Counter} = tline;
while ischar(tline)
Counter = Counter+1;
tline = fgetl(FID);
File_Data{Counter} = tline;
end
fclose(FID);
File_Data = File_Data';
This will give you your file cell variable File_Data.
You will probably have to find a cell that contains 'INCREMENT NUMBER', example, Increment number is line 8, then you take 8-3, 8-4, 8 and 8+1 line for a single increment number.
% 1 NODE FOOT- U1 U2 PU1 PU2
% 2 NOTE
% 3
% 4 3739 9.4520527E-02 -1.9431870E+00 9.5103755E-02 1.9543827E+00
% 5 3739 SSD 1.0516381E-02 -2.0889238E-01 6.3486346E+00 -1.7386427E+02
% 6
% 7
% 8 INCREMENT NUMBER 31
% 9 FREQUENCY = 78.976194
I would not know how this code below would work, but you can use some ideas from it.
Wanted_Rows = 1:1:length(File_Data);
Delete_Lines = [1:13 114 115 216 217, length(File_Data)]; % Last line of File_Data is -1 which denotes end of file so we remove it here
File_Data(Delete_Lines) = [];
File_Data_Split = split(File_Data(1:length(File_Data))); % Splits the cell
Data_Ready = cellfun(@str2num,File_Data_Split);
KSSV
el 20 de Oct. de 2020
Frank Oosterveld
el 21 de Oct. de 2020
Editada: Frank Oosterveld
el 21 de Oct. de 2020
Frank Oosterveld
el 21 de Oct. de 2020
Mario Malic
el 21 de Oct. de 2020
Great to hear it works, KSSV's solution might be more appropriate when you would like to generalise the information extraction, without writing down the wanted rows like in that example.
Respuestas (0)
Categorías
Más información sobre Large Files and Big Data en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!