How to call dos commands from MATLAB command window?

4 visualizaciones (últimos 30 días)
Arun Badigannavar
Arun Badigannavar el 22 de Jul. de 2016
Editada: Stephen23 el 22 de Jul. de 2016
I am trying to download SVN folder to my local copy, Using dos command
Output=dos(svn checkout /SVN Repository/ /Local Folder Path/)
which is not working, Any idea how to call dos command from MATLAB? Particularly I want to download SVN files without SVN dialogur box popup

Respuestas (2)

Stephen23
Stephen23 el 22 de Jul. de 2016
Editada: Stephen23 el 22 de Jul. de 2016
Read the dos help page. The help explains how dos must be called, and it also gives lots of examples for your to try.
In your case you need to provide a string. Try this:
out = dos('svn checkout /SVN Repository/ /Local Folder Path/')
If this does not work then you need to give us the exact and complete error message or description of what happens.
SVN is built into MATLAB: Note that MATLAB has SVN built in, so it is not required to call DOS or do any other hacking around:
  8 comentarios
Arun Badigannavar
Arun Badigannavar el 22 de Jul. de 2016
Stephen, It works perfectly in Command window, not in MATLAB, I consider there is no proper handshake between the MATLAB and DOS because of the command I am giving, There is Tortoise SVN already installed, and I am able to use the command checkout, But from dos command in MATLAB isnt working,Thanks for your suggestions
Walter Roberson
Walter Roberson el 22 de Jul. de 2016
You need to manipulate the PATH environment variable within MATLAB so that the directory holding SVN is on the path. Use getenv() and setenv() for that.
Or since it is all by way of program, hard-code the path to the executable, like
SVN_CMD = 'C:\Programs (x86)\TortoiseSVN\x64\svn.exe';
SVN_reposit = '/SVN Repository';
local_folder = '/Local Folder Path/';
this_cmd = sprintf('"%s" checkout "%s" "%s"', SVM_CMD, SVN_reposit, local_folder);
system(this_cmd);

Iniciar sesión para comentar.


KSSV
KSSV el 22 de Jul. de 2016
Editada: KSSV el 22 de Jul. de 2016
doc system...
system is used to call dos from MATLAB...
  1 comentario
Stephen23
Stephen23 el 22 de Jul. de 2016
According to the dos Mfile help: "This function is interchangeable with the SYSTEM and UNIX functions. They all have the same effect."

Iniciar sesión para comentar.

Categorías

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

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by