function downloadTrainedIndianPinesCSCNN(url,destination)
% The downloadTrainedIndianPinesCSCNN function downloads a pretrained 
% CSCNN network that classifies the Indian Pines hyperspectral data.
%
% Copyright 2020 The MathWorks, Inc.

filename = 'trainedIndianPinesCSCNN.mat';
netDirFullPath = destination;
netFileFullPath = fullfile(destination,filename);

if ~exist(netFileFullPath,'file')
    fprintf('Downloading pretrained CSCNN network.\n');
    fprintf('This can take several minutes to download...\n');
    if ~exist(netDirFullPath,'dir')
        mkdir(netDirFullPath);
    end
    websave(netFileFullPath,url);
    fprintf('Done.\n\n');
else
    fprintf('Pretrained CSCNN network already exists.\n\n');
end
end