Why does the EXIST function return an incorrect value in stand-alone mode?

Why does the EXIST function return an incorrect value in stand-alone mode?
Whenever I try to use the EXIST function in standalone mode, the wrong results are returned.
For instance the following code returns 0 in stand-alone mode:
function redbatmod
eat = 1;
exist('eat')
exist('flames')

 採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
The EXIST function has limitations for support in stand-alone mode. For more information, see the solution attached at the bottom of this page.
As a workaround, you can use either NARGIN or the following code, if you wish to check for the existence of a variable:
function texist2
nw = 2;
try
isempty(nw);
myexist=1;
catch
myexist=0;
end
fprintf(1,'exist: %d\n',myexist);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB Compiler についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by