get directory from edittext and use it in cd

조회 수: 1 (최근 30일)
mahmoud zemzami
mahmoud zemzami 2018년 8월 6일
편집: Fangjun Jiang 2018년 8월 6일
Hi, I'm new in Matlab. I created a gui with edittext, I want that the user type (or past) the location of the folder, and then get this location and set it in cd: x = get(handles.edit1,'String') cd x
  댓글 수: 1
Stephen23
Stephen23 2018년 8월 6일
편집: Stephen23 2018년 8월 6일
Don't use cd: changing the directory is slow and makes debugging more difficult. Instead, just use the directory path to create an absolute filename: all MATLAB functions that read/write files accept absolute filenames. Using absolute/relative filenames is much more efficient than changing directories.

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

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2018년 8월 6일
편집: Fangjun Jiang 2018년 8월 6일
I would suggest you use uigetdir(). Just run a=uigetdir and get a sense of it. You can pass the returned string a to the Editbox.

카테고리

Help CenterFile Exchange에서 Word games에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by