Using Remote Files in Matlab

If you have an FTP server set-up somewhere with ample space and bandwidth, Matlab can store and retrieve its files and data remotely. Just use these simple commands to connect and disconnect:

% File to connect to the server where my Matlab/data resides

% connect to the db
f = ftp(‘’, ‘user’, ‘password’);

% change the directory
cd(f, ‘matlab’);

% now change the directory that we want to download the directory
cd ‘/’;

% Download the directory
mget(f, ‘remote_dir’);

% *****************
% *****************

% when done move a directory here
cd ..
% now move the directory back to the server
mput(f, ‘remote_dir’);
disp(‘Files have been put back on the server’);

% close the connect