How can a function find location of itself?

조회 수: 44 (최근 30일)
Micke Malmström
Micke Malmström 2016년 6월 13일
답변: Walter Roberson 2016년 6월 13일
I want to save a file in the same location as the a function (ie not in the current folder). How can a function find get the location of itself?
(the file should handle being moved around, additionally, it will always be in some PATH)

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 13일
together with fileparts() to extract the directory portion, and fullfile() to construct the new file name.

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by