Dear all,
I wrote an function, which should download folder given in 'founded_medicine_folder.xls' as an url (see attachment). Unfortunately, I get an error, where it says:
'Error using fopen
First input must be a file name or a file identifier.
Error in download_edf>downloadFolderContentToCellArray
(line 31)
fileID = fopen(fileName, 'w');
Error in download_edf (line 2)
downloadFolderContentToCellArray(folderCellArrayData)'
1)What should I change that it considers the URL as an filename?
2) Can you observe if it would work?
folderCellArrayData = readcell('founded_medicine_folder.xls')
downloadFolderContentToCellArray(folderCellArrayData)
function downloadFolderContentToCellArray(folderCellArrayData)
import matlab.net.http.*
creds = Credentials('Username', '', 'Password', '');
options = HTTPOptions('Credentials', creds, 'ConnectTimeout', 60);
len = length(folderCellArrayData);
for x = 1:len
url = folderCellArrayData{x,1};
resp = RequestMessage().send(url , options);
i = strsplit(url, '/');
y = length(i);
fileName = i(y);
fileID = fopen(fileName, 'w');
fprintf(fileID, '%s', resp.Body.Data);
fclose(fileID);
end
end