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:UsersNEVERGUVEIPDesktop机器学习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. ');
 end
原文地址:https://www.cnblogs.com/neverguveip/p/9457294.html