enviinfo
Read metadata from ENVI header file
Syntax
Description
reads the metadata from ENVI (Environment for Visualizing Images) header file.info
= enviinfo(file
)
Note
This function requires the Image Processing Toolbox™ Hyperspectral Imaging Library. You can install the Image Processing Toolbox Hyperspectral Imaging Library from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
Examples
Read ENVI Header File
Read an ENVI header file into the workspace.
info = enviinfo('paviaU.hdr');
Create a hypercube
object using the Filename
of the ENVI header file.
hcube = hypercube(info.Filename)
hcube = hypercube with properties: DataCube: [610×340×103 double] Wavelength: [103×1 double] Metadata: [1×1 struct]
Read ENVI Binary Data File Using Metadata from ENVI Header File
Read an ENVI header file into the workspace.
info = enviinfo('indian_pines');
Read from the ENVI binary data file by using the metadata from the ENVI header file.
data = multibandread('indian_pines.dat',... [info.Height info.Width info.Bands],... info.DataType,info.HeaderOffset,info.Interleave,info.ByteOrder);
Input Arguments
file
— Name of ENVI header file
string scalar | character vector
Name of ENVI header file, specified as a string scalar or character vector. An ENVI
header file must have the extension .hdr
. If you do not specify a
file extension, then the function looks for a file with the specified name and the
.hdr
file extension.
Data Types: char
| string
Output Arguments
info
— Information about ENVI data and metadata
struct
Information about ENVI data and metadata, returned as a structure array containing at least these fields. If the ENVI header file contains additional fields, then the structure array contains those additional fields as well.
Field | Description |
---|---|
Height | Height of the image or number of rows in the image, returned as a positive integer. |
Width | Width of the image or number of columns in the image, returned as a positive integer. |
Bands | Number of spectral bands, returned as a positive integer. |
DataType | Data type of data in the ENVI file, returned as any of these values:
|
Interleave | Data interleave, returned as any one of these values:
|
HeaderOffset | Zero-based location of the first element in the image file, returned as a positive integer. The header offset represents the number of bytes from the beginning of the image file to the start of the image data. |
ByteOrder | Endianness of the data, returned as the string
"ieee-le" for little endian or
"ieee-be" for big endian. |
Version History
Introduced in R2020a
See Also
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)