Compose-3015: Reading Data from Text Files
This tutorial demonstrates how to extract nodal positions from the LS-DYNA input file, truck.key. This file can be found in <install>/tutorials/.
OML contains a set of commands that operate on string data types. You can use a combination of the string tools and file reading commands to read data from arbitrary text files.
Define the Target Variables
Create the General Structure to Read the File
[fid, message] = fopen(fileName, 'r');
line = fgetl(fid);
while ~feof(fid)
line = fgetl(fid);
end
disp('Finished reading the file')