Borrar filtros
Borrar filtros

what is the difference between pwd and cd ?

25 visualizaciones (últimos 30 días)
Leonardo Wayne
Leonardo Wayne el 21 de Mzo. de 2016
Editada: Stephen23 el 21 de Mzo. de 2016
what is the difference between pwd and cd ? I get the same folder when I tyoe command in MATLAB.

Respuestas (1)

Stephen23
Stephen23 el 21 de Mzo. de 2016
Editada: Stephen23 el 21 de Mzo. de 2016
Actually pwd just calls cd internally, so there is no real difference.
However I would suggest using pwd: Changing directories is a very slow way to write code (it is much faster to pass relative/absolute paths to any functions that access files of any kind), so using pwd has the advantage that it stylistically make it clear "this does NOT change the directory, we just need the path...".
In other words, using pwd encourages better programming habits.
Some faster alternatives to cd / pwd:
  • relative path names
  • the '.' notation refers to the current directory.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by