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.

 Akzeptierte Antwort

Star Strider
Star Strider am 31 Jul. 2014
Bearbeitet: Star Strider am 31 Jul. 2014

1 Stimme

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.

Weitere Antworten (0)

Kategorien

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by