Scope of variables passed to function handles?
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!