Problem with textread reading complex data

3 views (last 30 days)
Hello,
I try to have Matlab read data of the following structure:
Elmt Mat 1-coord 2-coord 3-coord
11-stress 22-stress 33-stress 12-stress 23-stress 31-stress
11-strain 22-strain 33-strain 12-strain 23-strain 31-strain
1-stress 2-stress 3-stress 1-strain 2-strain 3-strain
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
6 1 2.151E+00 1.067E+01 2.662E+01
-3.255E+01 1.091E+00 5.719E+01 1.348E+01 -6.564E+00 6.393E+00
4.186E-01 4.586E-01 -3.131E-01 1.685E-01 -4.689E-03 5.327E-03
5.821E+01 5.517E+00 -3.799E+01 6.083E-01 2.690E-01 -3.132E-01
6 1 2.302E+00 1.142E+01 2.662E+01
-6.642E+01 -1.567E+01 3.251E+01 1.357E+01 -1.212E+00 7.384E+00
4.498E-01 4.562E-01 -3.157E-01 1.696E-01 -8.655E-04 6.154E-03
3.306E+01 -1.228E+01 -7.036E+01 6.226E-01 2.835E-01 -3.157E-01
7 1 -2.000E+00 9.920E+00 3.381E+00
6.328E+00 1.939E+01 8.529E+01 -1.356E+01 1.200E+01 5.555E+00
3.832E-01 4.603E-01 -3.100E-01 -1.695E-01 8.571E-03 4.629E-03
8.754E+01 2.708E+01 -3.600E+00 5.956E-01 2.480E-01 -3.102E-01
FEAP * * Bending an Arc
Element Stresses
Elmt Mat 1-coord 2-coord 3-coord
11-stress 22-stress 33-stress 12-stress 23-stress 31-stress
11-strain 22-strain 33-strain 12-strain 23-strain 31-strain
1-stress 2-stress 3-stress 1-strain 2-strain 3-strain
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
5 1 7.778E+00 -7.778E+00 2.662E+01
2.736E+01 -1.534E+00 1.104E+02 -1.688E+01 -1.146E+01 -1.998E+01
3.505E-01 4.152E-01 -2.604E-01 -2.110E-01 -8.184E-03 -1.665E-02
1.155E+02 3.305E+01 -1.227E+01 5.964E-01 1.701E-01 -2.612E-01
with textread. I want to read all blocks of the structure
5 1 -3.255E+01 1.091E+00 5.719E+01 1.348E+01 -6.564E+00 6.393E+00
4.186E-01 4.586E-01 -3.131E-01 1.685E-01 -4.689E-03 5.327E-03
5.821E+01 5.517E+00 -3.799E+01 6.083E-01 2.690E-01 -3.132E-01
,thus skipping the dashed lines and words like "FEAP * * Bending an Arc" and the header with "Elmt Mat 1-coord" and so on which all will appear repetedly and regularly in the file I want to read data from. I use the following command
[Element,Mat,coord1,coord1,coord3,... stress11,stress22,stress33,stress12,stress23,stress31,... strain11,strain22,strain33,strain12,strain23,strain31,... stress1,stress2,stress3,strain1,strain2,strain3] = textread('NONE035.txt', '%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f%f',... 'whitespace',' \b\t\n\r',... 'headerlines',row);
but will get the following error messages:
??? Trouble reading floating point number from file (row 26, field 13) ==> FEAP * * Bending an Arc
Error in ==> textread at 177 [varargout{1:nlhs}]=dataread('file',varargin{:});
Error in ==> Tension at 4 [Element,Mat,coord1,coord1,coord3,...
Is there anything obviously wrong with this approach? I appreciate any kind of help!
Thank you very much in advance and with kind regards,
Tetzlaff

Answers (1)

bym
bym on 1 Apr 2011
try
textscan()

Categories

Find more on Stress and Strain in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!