Scope of variables passed to function handles?
古いコメントを表示
Hi, everyone,
I want to ask about the non-input variables in function handles.
For example, following code returns h(1)=2.
b=1;
h=@(a)a+b;
clear b;
display(sprintf('h(1)=%d', h(1)));
Is this kind of usage safe and correct?
Dehuan
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Whos についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!