For example: My pwd is C:\Abc\Xyz\1\1.1\p.cpp
I want to addpath to a previous directory than my cd i.e. I want to refer to directory named 1 (C:\Abc\Xyz\1).
How do I do this? I want to give path of the previous folder.

 채택된 답변

Star Strider
Star Strider 2014년 7월 31일
편집: Star Strider 2014년 7월 31일

1 개 추천

Use the fileparts function.
Example:
path = 'C:\Abc\Xyz\1\1.1\p.cpp';
[pathstr,name,ext] = fileparts(path);
The ‘pathstr’ variable will be the path string.

추가 답변 (0개)

카테고리

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

제품

질문:

2014년 7월 31일

편집:

2014년 7월 31일

Community Treasure Hunt

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

Start Hunting!

Translated by