handles to subfunctions?

3 次查看(过去 30 天)
In R2010b, I find that the Dependency Analyzer gives me warnings about not being able to find various routines; the routines it reports are subfunctions whose handle I am taking. For example,
uicontrol(...., 'Callback', @MyCallback)
then if MyCallback is a subfunction in the same file, the analyzer reports it as not found.
I checked the documentation for function_handle, which says
"At the time you create a function handle, the function you specify must be on the MATLAB path and in the current scope of the code creating the handle. For example, you can create a handle to a subfunction as long as you do so from within the file that defines that subfunction."
This seems to specifically allow the construct that the analyzer is having problems with.
R2008b's Dependency Analyzer correctly reports the routines as subfunctions.
Is this just a bug in R2010b's Dependency Analyzer, or is there a change in functionality at stake?

采纳的回答

Titus Edelhofer
Titus Edelhofer 2012-4-12
Hi Walter,
interesting observation. It persists in R2012a. On first glance I would agree this should be caught by dependency analysis. I will contact our development to see what's going on.
Thanks,
Titus

更多回答(1 个)

Richard Brown
Richard Brown 2012-4-11
The report does not list:
...
Files called from eval, evalc, run, load, function handles, and callbacks. MATLAB does not resolve these files until run time, and therefore the Dependency Report cannot discover them.
  2 个评论
Walter Roberson
Walter Roberson 2012-4-11
Hmmm... MATLAB doesn't resolve _any_ function until run time, but the dependency analyzer assumes "normal" processing and looks in scope and along the path, so the lack of resolution for function handles to subfunctions is remediable lack, it seems to me.
Richard Brown
Richard Brown 2012-4-11
I agree - function handles to subfunctions are entirely unambiguous

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by