Undefined function or variable 'case1' each time I start Matab and run the file

I have to "set path" my files in C:\Users\..\Documents\MATLAB each time I start Matlab and run it. After setting the path, the file can be run but once I close Matlab and restart it, I have to reset the path again. Any help would be appreciated. Thanks

Answers (1)

In the 'Set Path' dialog from the top ribbon there is a 'Save' option which should save for future sessions. I don't really understand what your question body has to do with your question title, but certainly for a persistent path across sessions you just need to save it.
savepath
will also do this programmatically.

5 Comments

Thank you Adam. The title is an error message I get each time I start Matlab and run my file. Of course, I save the set path after choosing "Add with subfolder" to add my files' path.
I am using the "set path" under Home button.
You say 'every time I start Matlab and run my file'.
There is a big difference in those two aspects. If it happens when you start Matlab then that is an entirely different issue, but if you mean it actually happens just when you run a certain file then it just means exactly what the error says - your function does not find 'case1' and it is not on the path either. Without seeing the code I don't know if 'case1' is supposed to be a variable or a function or what.
Sorry for that. But what I mean is: I start Matlab and open my file and then run it, I get the above error. Now, I set its path and save it, run the file once again, it works fine. Close Matlab, open the file, and then run it, again I get the same error and then set path will fix it as long as I don't close Matlab. Once I close Matlab, I have to set the path for all my files.
I have only 3 files in "Malab" folder getting the same error when ty to run them.

Sign in to comment.

Categories

Tags

Asked:

on 7 Dec 2016

Commented:

on 7 Dec 2016

Community Treasure Hunt

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

Start Hunting!