We are using the codetools function requiredFilesAndFolders to produce our project file at compile time which works well. Unfortunately it does not detect callback functions in one case. When the callback is declared using the syntax
set(myButton, 'Callback', 'myPackage.myFunction(''myParam'')')
then "myFunction" is not listed as a requirement:
>> matlab.codetools.requiredFilesAndProducts('myApp.m')'2×1 cell array {'myPath\myApp.m'} {'myPath\myApp.fig'}
However, if we use the syntax
set(myButton, 'Callback', @() myPackage.myMethod(''myParam'') )
then "myMethod" is listed as a requirement:
>> matlab.codetools.requiredFilesAndProducts('myApp.m')'3×1 cell array {'myPath\myApp.m'} {'myPath\myApp.fig'} {'myPath\+myPackage\myFunction.m'}
Why this difference and why is it not explained in the documentation page for "requiredFilesAndProducts"?
Best Answer