parfeval with backgroundpool and ftp and mget

1 回表示 (過去 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 Center および File ExchangeProgramming Utilities についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by