What does parse error basically mean?
426 ビュー (過去 30 日間)
古いコメントを表示
I just wanted to clarify in very layman terms what is a parse error?
0 件のコメント
回答 (3 件)
James Tursa
2014 年 7 月 5 日
When did you get this error? In general, the term "parsing" refers to MATLAB reading an m-file (script or function) and translating it into an internal code that it stores in memory. It is this "parsed" file in memory that is actually run when you execute the code.
0 件のコメント
Image Analyst
2014 年 7 月 5 日
You might have some code that throws an exception (generates an error) like this:
try
% Some code that might generate an error.
catch ME
errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ...
ME.stack(1).name, ME.stack(1).line, ME.message);
fprintf(1, '%s\n', errorMessage);
uiwait(warndlg(errorMessage));
end
The error here is a string in ME.message. Parse it means that you might look at the error and try to recognize certain words and take action based upon what you find. For example you might have an error that says this:
Error using imread (line 349)
File "sss.dd" does not exist.
and you might want to do some particular thing, like alert the programmer that the file doesn't exist and to make sure the folder is prepended to the filename
if ~isempty(strfind('does not exist') ) % Parse error message
warndlg(..............
0 件のコメント
Angie
2022 年 7 月 16 日
error: parse error: syntax error >>> y3 = sin(x)cos(x); ^ error: 'y3' undefined near line 1, column 1 warning: legend: ignoring extra labels warning: called from __gnuplot_legend__ at line 490 column 13 legend at line 198 column 37
1 件のコメント
Image Analyst
2022 年 7 月 16 日
You'd need a .* between sin and cos like
y3 = sin(x) .* cos(x);
Of course x also needs to be defined before that line.
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!