Using addpath with file/folder names with / and :
조회 수: 5 (최근 30일)
이전 댓글 표시
I am using the addpath to link a folder to my path, but the name of the folder includes a /, how do I include characters such as / and : in the file name?
댓글 수: 1
답변 (2개)
Image Analyst
2014년 10월 4일
What operating system is this? I know for a fact that you cannot have a folder name with a / or \ in it in Windows. If you made it up, then you can combine with fullfile
myDrive = 'D:\';
myFolder = 'data/results\run 1';
fullPath = fullfile(myDrive, myFolder)
but in the above case the folder is actually 3 folder names concatenated. Note Windows does not care about forward or backslash and will work just fine with either one.
댓글 수: 4
José-Luis
2014년 10월 4일
I learned something today. I only use Linux and Windows and there the slash is a no-no.
Sorry for my somewhat flippant and mistaken answer.
Image Analyst
2014년 10월 4일
So, Claudy, Jose-Luis's link says that slash is permitted but colon is prohibited. So then, how are you creating folders with colon in them on your Mac, as you said in your original question?
Miles Milner
2020년 4월 9일
Hi I have a similar problem, my file directory has a ' in the name and that character closes the arguement
addpath('C:\Users\Miles' PC\Documents\MSc Medical Physics\BP5901 MSc Project\Dicom data')
what do I do? you can see in Miles' it stops being pink...
Please help!!
댓글 수: 3
Image Analyst
2020년 4월 10일
Miles, try using double quotes:
myFolder = "C:\Users\Miles' PC\Documents\MSc Medical Physics\BP5901 MSc Project\Dicom data"
addpath(myFolder);
참고 항목
카테고리
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!