Why can't Matlab find functions from a project folder within another project folder?

조회 수: 8 (최근 30일)
EDIT I misread the terminology. When I wrote "project folder" I meant "package folder".
I have added several folders to Matlab's search path. One of the folders is a project folder's parent folder. That single project folder contains three more project folders.
Matlab finds all functions from the other folders just fine, but it does not find anything from the project folder's sub-project folders. What am I doing wrong?
Here is a screenshot of the folders I have added to the path
D:\Work\matlab_mit is the parent folder to a project folder +MIT. Inside the +MIT folder, there is another project folder +jsonlab. In this case I am trying to use the function loadjson.m which is inside the +jsonlab folder. But it does not work if +jsonlab is not the current folder.
I can open the functions from the +MIT folder just fine, but not from the sub-project folders. The project folder +MIT cannot be added to path.
Why can't the functions in the sub-project folders be found when the parent project folder's parent folder is added to path?

채택된 답변

Stephen23
Stephen23 2021년 3월 3일
편집: Stephen23 2021년 3월 3일
Folders starting with "+" are package folders:
The documentation explains that to refer to a function in the package folder, the package can either be imported or the function must be fully qualified with the package name. This is an example given in the documentation:
"For example, call this package function:"
+mypack/pkfcn.m
"With this syntax:"
z = mypack.pkfcn(x,y);
You can access the package contents using the syntax given in the documentation.
The answer to your question "Why can't Matlab find functions from a project folder within another project folder?" is also explained in the documentation for packages, in the section entitled "Packages and the MATLAB Path":

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Adding custom doc에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by