DS2019
DS2019

Reputation: 25

Accessing folders via MATLAB

I am trying to access some .m folders that I have downloaded into Downloads. How can I access this folder and run the files using cd similar to how I would on a Terminal (MacOS)? The same statements don't work.

Upvotes: 0

Views: 63

Answers (2)

am304
am304

Reputation: 13876

You need to pass the absolute path of your Downloads folder, e.g.:

current_dir = pwd;
cd('C:\Users\you_username\Downloads')

Then, you'll be able to access the files in that folder. When you are finished, you can then return to your original folder with:

cd(current_dir);

An alternative is to add the Downloads folder to your MATLAB path with addpath. You should then be able to access files in there from any directory of your choosing without having to cd. If you want to make that change to the MATLAB path permanent, use savepath afterwards to save the MATLAB path for future sessions.

Upvotes: 1

excelhelp
excelhelp

Reputation: 91

All of the regular commands for linux should work.

ls, dir, cd 'your folder goes here' , cd ,, , cd.. etc

Upvotes: 2

Related Questions