Geoscience Reference
In-Depth Information
I = uint8(I);
Typing whos then yields
Name Size Bytes Class Attributes
I 100x100x3 30000 uint8
I1 100x100 80000 double
I2 100x100 80000 double
I3 100x100 80000 double
Since 8 bits can be used to store 256 dif erent values, this data type can be
used to store integer values between 0 and 255, whereas using int8 to create
signed 8-bit integers generates values between -128 and +127. h e value of
zero requires one bit and there is therefore no space let in which to store
+128. Finally, imshow can be used to display the three-dimensional array as a
true color image.
imshow(I)
We next introduce structure arrays as a MATLAB data type. Structure
arrays are multi-dimensional arrays with elements accessed by textual i eld
designators. h ese arrays are data containers that are particularly helpful in
storing any kind of information about a sample in a single variable. As an
example we can generate a structure array sample_1 that includes the image
array I dei ned in the previous example as well as other types of information
about a sample, such as the name of the sampling location, the date of
sampling, and geochemical measurements, stored in a 10-by-10 array.
sample_1.location = 'Plougasnou';
sample_1.date = date;
sample_1.image = I;
sample_1.geochemistry = rand(10,10);
h e i rst layer of the structure array sample_1 contains a character array, i.e.,
a two-dimensional array of the data type char containing a character string.
We can create such an array by typing
location = 'Plougasnou';
We can list the size, class and attributes of a single variable such as location
by typing
whos location
and learn from
Name Size Bytes Class Attributes
location 1x10 20 char
Search WWH ::




Custom Search