Fixing File Paths to Run on Multiple Computers
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have a Matlab program that needs to run on multiple computers, however the program searches for folders that are outside of the directory. I am stuggling to figure out how I can change file paths so that they work on multiple computers.
Here's my issue:
if ~exist('C:\Users\nperson\Desktop\F-DAS Matlab\ProcessFiles', 'dir') %check to see if processfiles folder exists
mkdir('C:\Users\nperson\Desktop\F-DAS Matlab\','ProcessFiles') %create the folder if it doesn't
end
cd('C:\Users\nperson\Desktop\F-DAS Matlab\ProcessFiles') %change current directory to processfiles
copyfile('C:\Users\nperson\Desktop\F-DAS Matlab\RAW', 'C:\Users\nperson\Desktop\F-DAS Matlab\ProcessFiles') %copy files from RAW data to the processfiles folder
As you can see all file paths use 'C:\Users\nperson\Desktop\F-DAS Matlab\..' which will only work on my computer, how can I use relative file paths so it works on multiple computers.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur File Operations 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!