parfeval with backgroundpool and ftp and mget

조회 수: 2 (최근 30일)
William Thielicke
William Thielicke 2024년 12월 17일
댓글: Mike Croucher 2024년 12월 18일
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개)

카테고리

Help CenterFile Exchange에서 FTP File Operations에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by