string variable and command prompt
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Keith Holmlund
le 20 Juin 2018
Modifié(e) : Stephen23
le 20 Juin 2018
I know you can use a string variable with cd such as dir = 'C:Users\User\Documents\Matlab' then cd(dir). Is that same type of command possible using the system command such as [status] = system('move dir\file.txt newlocation')
2 commentaires
Adam
le 20 Juin 2018
I would have though you could try it and get an answer far faster than on here! As far as I know the string you give to the system function will be interpreted in the context of the command line so if it is valid in that context then it would work, otherwise not.
Réponse acceptée
Philip Borghesani
le 20 Juin 2018
Short answer: yes.
Long answer: Any MATLAB function that takes one or more character vectors as input can be called in command mode see command-vs-function documentation for more information.
I am a bit surprised you had to ask is something not working the way you expect it to?
4 commentaires
Philip Borghesani
le 20 Juin 2018
You might try movefile for this instead. Error handling will be simpler, it can work on all platforms, and it is probably faster.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!