run GUI without importing the folder in the current folder?
2 次查看(过去 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!