parfeval with backgroundpool and ftp and mget

2 次查看(过去 30 天)
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 个评论
William Thielicke
William Thielicke 2024-12-17
It seems like mget is not working with a thread based environment as required by backgroundpool. Websave has this kind of support:
https://www.mathworks.com/help/matlab/referencelist.html?type=function&capability=threadsupport
Mike Croucher
Mike Croucher 2024-12-18
I'll add an enhancement request for mget and thread-based environments to our internal database.

请先登录,再进行评论。

回答(0 个)

产品


版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by