How to determine subdirectory path from within a class

조회 수: 3 (최근 30일)
Scott
Scott 2017년 8월 1일
댓글: Scott 2017년 8월 1일
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?

채택된 답변

Matt J
Matt J 2017년 8월 1일
편집: Matt J 2017년 8월 1일
thepath = which('yourClass')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 File Operations에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by