how to avoid CDing a text file in a dir
Show older comments
I have 100s of folders that i need data from but part of the main folder theres txt file that i need to bypass..
when my code CDs the text file it crashes. how may i avoid this
paramater_data_folder = [starting_point,'\',folder_to_pass,'\']; % data folder
cd(paramater_data_folder)
5 Comments
Stephen23
on 3 Jan 2023
"how to avoid CDing a text file in a dir"
Every MATLAB function that imports/exports/processes data files will accept absolute/relative filenames. Using absolute/relative filenames is simple and efficient. In contrast, using CD is slow and makes debugging harder.
Ihaveaquest
on 3 Jan 2023
"sorry not sure how that helps me"
Your question is entitled "how to avoid CDing a text file in a dir". Ergo, I just told you the best way to avoid CDing to any folder: use absolute/relative filenames. Don't use CD at all. CD is not required for processing data files.
Ihaveaquest
on 3 Jan 2023
Accepted Answer
More Answers (0)
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!