필터 지우기
필터 지우기

How to get directory of Document folder in a non-MATLAB computer when using a fully standalone application?

조회 수: 25 (최근 30일)
Hi,
My fully standalone application prompts a message to choose where to save a file. When the message shows, the default folder which I want will be '....\My Document'. When I use 'uigetdir('Choose ') on my computer which has MATLAB it shows a MATLAB default folder '....\My Document\MATLAB'. So how about on a non-MATLAB computer? Will 'uigetdir' show '....\My Document'?
Welcome any helps.
Thanks.

채택된 답변

Image Analyst
Image Analyst 2014년 10월 18일
Try this:
% Get the name of the user who logged in to the computer.
userProfile = getenv('USERPROFILE')
% Create a string to the "My Documents" folder of this Windows user:
myDocsFolder = sprintf('%s\\My Documents', userProfile)
In the command window:
userProfile =
C:\Users\Khanh
myDocsFolder =
C:\Users\Khanh\My Documents
Then you can call
usersChosenFolder = uigetdir(myDocsFolder);
  댓글 수: 1
Khanh
Khanh 2014년 10월 18일
Great. Thank you. It worked fine on my computer. I will check a standalone appication with your code on a non MATLAB computer and let you know it when I get result.

댓글을 달려면 로그인하십시오.

추가 답변 (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