get directory from edittext and use it in cd

1 visualización (últimos 30 días)
mahmoud zemzami
mahmoud zemzami el 6 de Ag. de 2018
Editada: Fangjun Jiang el 6 de Ag. de 2018
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 comentario
Stephen23
Stephen23 el 6 de Ag. de 2018
Editada: Stephen23 el 6 de Ag. de 2018
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.

Iniciar sesión para comentar.

Respuestas (1)

Fangjun Jiang
Fangjun Jiang el 6 de Ag. de 2018
Editada: Fangjun Jiang el 6 de Ag. de 2018
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.

Categorías

Más información sobre Word games en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by