run GUI without importing the folder in the current folder?

2 views (last 30 days)
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.

Answers (1)

Image Analyst
Image Analyst on 12 Jan 2016
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 Comments
Praveen Choudhury
Praveen Choudhury on 12 Jan 2016
importing the folder means I am adding the folder in my matlab window (in the left window which says current folder). I want to write a code where the folder automatically gets added in the matlab window(current folder)
Image Analyst
Image Analyst on 12 Jan 2016
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.

Sign in to comment.

Categories

Find more on Search Path in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!