For files in a package, you need to input the file name without the '.m' on the end of it, so if you change your command to:
>> [fList,pList] = matlab.codetools.requiredFilesAndProducts('packageName.functionName');
you should get the output you expect.
Similarly, if you were to run the "which" command with the '.m' included, it would return zero results:
>> which packageName.functionName.m
This is the implied "which" call that your previous instance of "requiredFilesAndProducts" was calling.
The reason the '.m' cannot be on the name is because the file is in a private package - it is effectively a method of the package name, rather than a normal script or function. For example, you cannot call your M file from outside the package with the '.m' included in the name either - it would return an "undefined variable" error.
Another tool that you may find useful for your work is the Dependency Report, which provides more in-depth information than "requiredFilesAndProducts". You can read more about the Dependency Report on the following documentation page:
Best Answer