MATLAB: How to import a text and numerical file

input files

Hi all,
I am kind of new with matlab and I need to import an input file in the following format:
*heading
cantilever beam (units: lb, in)
*nodal coordinates
1, 0.00, 0.00
2, 0.06, 0.00
3, 0.06, 0.03
4, 0.00, 0.03
*nodal fixity
1, known, known, 0.0, 0.0
4, known, known, 0.0, 0.0
*nodal loads
3, 0.0, -10000.0, 0.0
*element data
1, plane stress, 1, 2, 3, 4, 0.01, 70e9, 0.33, 0
*element loads
*end
how can I read this file and use input data? The size of nodal coordinates,nodal fixity, nodal loads, element data and element loads may vary.
Thank you

Best Answer

fopen(), fgetl(), fclose()
regexp(), strcmp(), sscanf()