issue with using a variable for path name
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
sri satya ravi
il 7 Apr 2022
Commentato: sri satya ravi
il 8 Apr 2022
I tried to save my path address to a variable and use the variable as CD funtion but i am getting an error.
Path = ('H:\dcx_cpe\CRANE\Truck Data');
cd('Path');
I am getting the below error.
Cannot CD to H:\dcx_cpe\CRANE\Truck Data\Path (Name is nonexistent or not a directory).
How do i fix this issue?
1 Commento
Stephen23
il 7 Apr 2022
Do not CD just to import/export data files. CD is slow and makes debugging harder.
Every function that import/exports datafiles accepts absolute/relative filenames. You should use absolute/relative filenames.
Risposta accettata
Fangjun Jiang
il 7 Apr 2022
cd(Path).
avoid using 'Path' as variable name as path() is a function.
7 Commenti
Steven Lord
il 7 Apr 2022
If you need to change the current directory, change it once not twice. That's like walking through a door then immediately walking through that same door again -- you end up where you started.
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Search Path in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!