correct my Postprocessing code

5 ビュー (過去 30 日間)
sphinx mo
sphinx mo 2011 年 10 月 6 日
Hi,
I am trying to get 3 surface graph from my output results of Matlab. The postprocessing code is always showing me an error when using str2num.
here you will find the inp and out file which will be asked by post-processing file.
please find out my wrong
the error comes like this one ??? Error TMP = str2num(fgets(INP2));

回答 (2 件)

Walter Roberson
Walter Roberson 2011 年 10 月 7 日
Change your line
TMP = str2num(fgets(INP2));
to
thisline = fgets(INP2);
if ~ischar(thisline)
error('Ran out of input, or serious input error')
end
try
TMP = str2num(thisline);
catch
error(['Substantial input error trying to understand line: ', thisline]);
end
if any(isnan(TMP))
warning(['Line could not be interpreted as numbers: ' thisline]);
end
I have not looked at the program itself, but I note that if it ever got as far as the input line
Elem# N1 N2 N3 N4 Mat# Thickness TempRise
then it would run in to trouble. I would not expect an error to be generated though.

Fangjun Jiang
Fangjun Jiang 2011 年 10 月 7 日
Check the help of fgets(). Maybe you want to try fgetl()?

カテゴリ

Help Center および File ExchangeData Type Conversion についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by