matlab根据url链接下载*.tar文件并解压

1、解压url链接的*.tar.gz文件到Data文件夹中,matlab会在当前目录自己创建Data文件夹。

url = 'https://www.cs.toronto.edu/~kriz/cifar-10-matlab.tar.gz';

untar(url, 'Data'); 

2、这个是更啰嗦、严谨的代码

cifar10Data = 'C:\Users\NEVERGUVEIP\Desktop\机器学习\example_code';
url = 'https://www.cs.toronto.edu/~kriz/cifar-10-matlab.tar.gz';
unpackedData = fullfile(cifar10Data, 'cifar-10-batches-mat1');
if ~exist(unpackedData, 'dir')
fprintf('Downloading CIFAR-10 dataset (175 MB). This can take a while...');     
 untar(url, 'cifar10Data'); 
 fprintf('done.\n\n');
 end
posted @ 2018-04-07 15:37  吴春旭  阅读(912)  评论(0编辑  收藏  举报