-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwebsave.m
More file actions
32 lines (28 loc) · 1.05 KB
/
websave.m
File metadata and controls
32 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
% dataFolder = tempdir;
% dataFilename = "PandasetSensorData.zip";
% url = "https://ssd.mathworks.com/supportfiles/driving/data/" + dataFilename;
% filePath = fullfile(dataFolder,dataFilename);
% if ~isfile(filePath)
% websave(filePath,url)
% end
% websave(filePath,url)
% C:\BaiduSyncdisk\matlab\toolbox\matlab\external\interfaces\webservices\restful\websave.m
% 重写文件下载函数:如果本地ssd目录存在就不从网上下载。
function filename = websave(filename, url, options)
cur_dir = pwd;
disp('custom websave');
[~, name, ext] = fileparts(url);
global local_ssd
local_filename = fullfile(local_ssd, append(name, ext));
if exist('local_ssd', 'var') && exist(local_filename, 'file')
copyfile(local_filename, fileparts(filename));
else
cd(fullfile(toolboxdir('matlab'), 'external', 'interfaces', 'webservices', 'restful'));
if nargin == 2
websave(filename, url)
else
websave(filename, url, options)
end
cd(cur_dir);
end
end