How to use RETR for FTP in Matlab

4 views (last 30 days)
Leah Busch
Leah Busch on 21 Jun 2018
Commented: Matt C on 25 Jul 2018
Is there a way to use RETR to get a file in MATLAB instead of MGET? I am trying to retrieve a file from a server in MATLAB and my server does not open the data stream for
mget(ftpobject,'file')
However, I do retrieve the file if I use python's
ftplib.ftp.retrbinary('RETR file')
but due to project restrictions I have to use MATLAB and cannot modify the server. I have also looked at using SFTP using a Ganymede implementation found here. However, my server is not SFTP enabled and again, I cannot change this permission due to project restrictions.
  1 Comment
Matt C
Matt C on 25 Jul 2018
It looks like an RETR function does not exist in MATLAB. The documentation for using FTP in MATLAB is found here:
https://www.mathworks.com/help/matlab/ref/ftp.html
Something that may help is this documentation on how to perform all of the different operations using the FTP class in MATLAB. The link is below:
https://www.mathworks.com/help/matlab/import_export/performing-ftp-file-operations.html
Something you could also try is setting the mode to ASCII or binary by using the ascii() or binary() functions for the FTP object.
Finally, one last debugging step you could try is to check what is getting returned by the mget call. The function should return a cell array containing the path to the file that was downloaded to your machine.

Sign in to comment.

Answers (0)

Tags

Products


Release

R2017b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!