oddity with displaying function handles

5 visualizaciones (últimos 30 días)
Stephen Vavasis
Stephen Vavasis el 5 de Mzo. de 2017
Respondida: Walter Roberson el 5 de Mzo. de 2017
In Matlab version 9.1, observe:
>> f = @(x)(1);
>> f = @(x)(f(x)+1)
f =
function_handle with value:
@(x)(f(x)+1)
>> f(5)
ans =
2
The oddity is: when f itself is displayed, the symbol 'f' appearing inside the display refers to an older version of f rather than the current version. Is there a way to see what is 'really' inside the function handle?

Respuestas (1)

Walter Roberson
Walter Roberson el 5 de Mzo. de 2017
In a situation such as that,
s = functions(f)
s.workspace{1}.f

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by