parfeval with backgroundpool and ftp and mget
Afficher commentaires plus anciens
Hi, I want to download a file via ftp, and display the progress during download. This works with websave, but I can't get it to work with ftp. Is this not supported, or am I doing something wrong...?
The error message in ME is:
ME =
MException with properties:
identifier: 'MATLAB:string:MissingNotSupported'
message: '<missing> string element not supported.'
cause: {}
stack: [3×1 struct]
Correction: []
function FetchPylon()
FileName = 'pylon.exe';
FilePath=userpath;
ftpobj = ftp('sl290.web.hostpoint.ch','ftp2@pivlab.de');
F = parfeval(backgroundPool,@download_stuff,1,ftpobj,FileName,FilePath);
pause(1)
[ME]=fetchOutputs(F)
fig = uifigure;
fig.Visible='off';
fig.Position = [680 687 444 191];
movegui(fig,'center');
fig.Resize='off';
fig.WindowStyle = 'modal';
fig.Visible='on';
d = uiprogressdlg(fig,'Title','Please Wait','Message','Downloading OPTOcam driver','Cancelable','on');
progress=0;
cancelled=0;
while strcmpi (F.State, 'running')
s = dir(fullfile(FilePath,FileName));
if ~isempty(s)
filesize = s.bytes;
progress= (filesize/1028320736);
d.Value=progress;
d.Message = ['Downloading OPTOcam driver (' num2str(round(filesize/1024/1024)) ' / ' num2str(round(1028320736/1024/1024)) ' MB done).'];
end
if d.CancelRequested
cancel(F)
cancelled=1;
break
end
pause(0.25)
end
close(d)
close(fig)
function [ME]=download_stuff (ftpobj,FileName,FilePath)
try
mget(ftpobj,FileName,FilePath);
catch ME
end
pause(1)
close(ftpobj)
clearvars('ftpobj')
2 commentaires
William Thielicke
le 17 Déc 2024
Mike Croucher
le 18 Déc 2024
I'll add an enhancement request for mget and thread-based environments to our internal database.
Réponses (0)
Catégories
En savoir plus sur FTP File Operations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!