parfeval with backgroundpool and ftp and mget

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
William Thielicke
William Thielicke il 17 Dic 2024
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 il 18 Dic 2024
I'll add an enhancement request for mget and thread-based environments to our internal database.

Accedi per commentare.

Risposte (0)

Prodotti


Release

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by