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
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.
MiauMiau
MiauMiau 2014년 3월 4일
so this is already all the script (I justed wanted to understand these functions). So addpath would only work if c would be the very starting point of the path? What then about addpath .... -end? Is this not going for the end of a path?

댓글을 달려면 로그인하십시오.

 채택된 답변

Image Analyst
Image Analyst 2014년 3월 4일

0 개 추천

Try this
addpath(genpath('c:/matlab/myfiles'));
I do it all the time and it works great.

댓글 수: 3

MiauMiau
MiauMiau 2014년 3월 4일
great but what is the difference to using addpath with the "end" suffix?
Matt J
Matt J 2014년 3월 4일
편집: Matt J 2014년 3월 4일
If you print your path string using the PATH command you will see that addpath appends things to the beginning of the path string by default (without "end"). With the "end" flag, it will append them at the end of the path string.
Image Analyst
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개)

카테고리

도움말 센터File Exchange에서 Search Path에 대해 자세히 알아보기

태그

질문:

2014년 3월 4일

댓글:

2014년 3월 4일

Community Treasure Hunt

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

Start Hunting!

Translated by