run GUI without importing the folder in the current folder?
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a GUI. When I run it with importing the folder in my current folder, it works fine. But when I just run it without importing any folder in my current folder, it shows error and it doesnt work. I would want my GUI to run when ever a user double clicks on it. I think it has something to do with path.
댓글 수: 0
답변 (1개)
Image Analyst
2016년 1월 12일
What does "importing the folder in my current folder" even mean??? Do you mean that you have an m-file, or several of them, in some arbitrary folder, and then you copy that whole folder so that it is now a subfolder of your current folder?
Did you try to point to the path with the Set Path button on the Home tab of the tool ribbon?
댓글 수: 2
Image Analyst
2016년 1월 12일
That is not importing the folder. It is "setting" the current folder to that folder.
To add a folder to the search path, use addpath().
To save the newly modified search path for future MATLAB sessions, use the savepath() function. Alternatively, use addpath statements in a startup.m file to modify the search path programmatically at startup.
If you use addpath within a local function, the path change persists after program control returns from the function. That is, the scope of the path change is global.
Or else use the Set Path button like I already explained.
참고 항목
카테고리
Help Center 및 File Exchange에서 Search Path에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!