%% Read and Visualize Hyperspectral Data from ENVI File
% Read hyperspectral data stored in the ENVI format into the workspace. Create a hypercube object by specifying an ENVI data file and the associated ENVI header file.

hcube = hypercube('paviaU.dat','paviaU.hdr');

% Display the properties of the hypercube object.

hcube

% Estimate an RGB image from the hyperspectral data by using the colorize function. Visualize the RGB image.

rgbImg = colorize(hcube,'Method','RGB');
figure
imagesc(rgbImg)
title('RGB Image of Data Cube')

% Inspect the metadata of the hypercube object.

hcube.Metadata

% Copyright 2020 The MathWorks, Inc.