Question to mkdir and addpath
5 次查看(过去 30 天)
显示 更早的评论
Hi
As I understand, the following code:
mkdir('c:/matlab/myfiles')
addpath('c:/matlab/myfiles')
First creates the folders in question, and in the second line makes it possible to call functions and the like from this folder (and all their subfolders and hence this is why it says the folders are added to the "top" of the search file?)
Unfortunately, I get the following warning (my script is called "test"):
Warning: Name is nonexistent or not a directory: c
> In path at 110
In addpath at 87
In test at 4
Warning: Name is nonexistent or not a directory: /matlab/myfiles
> In path at 110
In addpath at 87
In test at 4
What is that supposed to mean?
2 个评论
Matt J
2014-3-4
Did you intend to attach your test script? It didn't make it.
Incidentally, ADDPATH will not add subfolders. You need GENPATH for that.
采纳的回答
Image Analyst
2014-3-4
Try this
addpath(genpath('c:/matlab/myfiles'));
I do it all the time and it works great.
3 个评论
Image Analyst
2014-3-4
Generally you only need to worry about it if you're running two versions of MATLAB at the same time, and even then, not always.
更多回答(0 个)
另请参阅
类别
在 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!