How to determine subdirectory path from within a class

3 Ansichten (letzte 30 Tage)
Scott
Scott am 1 Aug. 2017
Kommentiert: Scott am 1 Aug. 2017
I am trying to create an object from a class whose directory contains sub folders that contain data files which the class needs to load. The Class folder is set in the MATLAB path so I can access it however I cannot load the files from the sub folders within the MATLAB class folder without having to type the entire directory of the sub folders into the class. I tried using pwd in the class but this returns the path for my script not the class folder. Is there a way for the class to access its own path?

Akzeptierte Antwort

Matt J
Matt J am 1 Aug. 2017
Bearbeitet: Matt J am 1 Aug. 2017
thepath = which('yourClass')

Weitere Antworten (0)

Kategorien

Mehr zu File Operations finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by