image

Display a matrix as an image, based on the current color map.

Syntax

h = image(z)

h = image(x, y, z)

h = image(property, value...)

Inputs

z
Matrix specifying the data for the matrix to be displayed. This can also be specified by the property 'cdata'.
Type: vector | matrix
x
Optional vector to specify the maximum and mininum values of the x-axis.
Type: vector
y
Optional vector to specify the maximum and mininum values of the y-axis.
Type: vector
property, value
'cdata'
Specifies the data which is displayed by h. This is the same as specifying z.
Type: matrix
'displayname'
Specifies the label displayed on the color map associated with h.
Type: string
'parent'
Specifies the parent (figure). Once h has been created, it cannot be re-parented to a different figure.
Type: scalar
'tag'
User-defined string to tag graphical control objects.
Type: string
'userdata'
User-defined numerical data.
Type: mtx
'visible'
Specifies if h is visible. Valid values are 'on'(default) and 'off'.
Type: 'on' | 'off'
'xdata'
Specifies the maximum and minimum values of the x-axis. This is the same as specifying x.
Type: vector
'ydata'
Specifies the maximum and minimum values of the y-axis. This is the same as specifying y.
Type: vector

Outputs

h
Handle of the image object.

Examples

Set the legend display and userdata:
z1 = [27 2 3; 4 5 36; 7 8 9];
h = image(z1, 'displayname', 'My title', 'userdata', [50, 51]);
Update values:
h = image([1 2 3; 4 5 6; 7 8 9]);imagesc(z, [3 7]);
set(h, 'xdata', [1 15], 'ydata', [2 5], 'cdata', eye(4))

Comments

If there are no axes, they will be created first. If x and y are omitted, the index of the z columns is used for the x coordinates and the index of the z rows is used for the y coordinates.