image
Display image on block mask icon
Description
image( displays the image
          maskImage)maskImage on the block mask icon. 
image(
        provides the position and size of the image within the block mask icon.maskImage,positionAndSize)
image(
        specifies whether the image rotates along with the icon or remains stationary.maskImage,positionAndSize,rotation)
Examples
Multiple image commands are used in this masked block to indicate the block capabilities.
The block mask icon consists of four separate images:
- The image in the center of the block mask icon, stored in - block_icon_controller.png.
- A company logo in the bottom right, stored in - company_logo.png.
- Two icons in the bottom left indicating that you can compile and build code for the block, stored in - block_capability_compile.pngand- block_capability_build.png.

Use this code to display the images in the block mask icon.
% The second argument of the image command specifies % the location and size of the image on the block mask icon % in the format [x,y,w,h] where: % % x is the horizontal displacement with % respect to the bottom left corner. % % y is the vertical displacement with % respect to the bottom left corner. % % w is the width of the image. % % h is the height of the image. % % Compute the width and height relative to the total block mask % icon size to make sure that images scale with block resizing. image('block_icon_controller.png',[10,10,85,40]); image('company_logo.png',[95,2,10,10]); image('block_capability_compile.png',[7,2,8,8]); image('block_capability_build.png',[18,2,10,10]);
Input Arguments
Image that is displayed on the block mask icon, specified as one of these options:
- An m-by-n-by-3 array of RGB values. Where m and n are the size of the image in pixels. 
- The name of an image file, specified as a string scalar or character vector. 
Note
Images in formats .cur, .hdf4,
                .ico, .pcx, .ras,
                .xwd, cannot be used as block mask images.
Example: image('icon.jpg')
Data Types: matrix | string | char
Position and size of the image, specified as a numeric array of the form
              [x, y, w, h] where, 
- x— Horizontal displacement of the image from the bottom left corner of the icon as a percentage of the total width of the icon.
- y— Vertical displacement of the image from the bottom left corner of the icon as a percentage of the total height of the icon.
- w— Width of the image specified as defined by the Icon Units
- h— Height of the image specified as defined by the Icon Units
When you use these values, the size of image does not scale with the size of the block mask icon when you resize the block.
You can also specify image alignment details including alignment to the left, right,
            top, and bottom margins as a numeric array of the form [a, b, c, d, w,
              h].  Additionally, you can specify the percentage of width and height for
            the image, ensuring that the entire image is visible within the block.
- a— Left margin of the image specified in Icon Units
- b— Top margin of the image specified in Icon Units
- c— Right margin of the image specified in Icon Units
- d— Bottom margin of the image specified in Icon Units
- w— Width of the image as a percentage of the total width of the icon
- h— Height of the image as a percentage of the total height of the icon
You can also specify position as shown in the table.
Image Position
| Value | Position in the block mask icon | 
|---|---|
| "center" | Center | 
| "top-left" | Top left corner | 
| "bottom-left" | Bottom left corner | 
| "top-right" | Top right corner | 
| "bottom-right" | Bottom right corner | 
Example: image('company_logo.png',[95,2,10,10])
Example: image("block_icon_controller.png","center")
Data Types: array | string | char
Option to specify whether the image rotates or remains stationary as the icon
            rotates, specified as 'off' or 'on'.
Example: image('company_logo.png',[95,2,10,10],'off')
Version History
Introduced in R2006a
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.
Website auswählen
Wählen Sie eine Website aus, um übersetzte Inhalte (sofern verfügbar) sowie lokale Veranstaltungen und Angebote anzuzeigen. Auf der Grundlage Ihres Standorts empfehlen wir Ihnen die folgende Auswahl: .
Sie können auch eine Website aus der folgenden Liste auswählen:
So erhalten Sie die bestmögliche Leistung auf der Website
Wählen Sie für die bestmögliche Website-Leistung die Website für China (auf Chinesisch oder Englisch). Andere landesspezifische Websites von MathWorks sind für Besuche von Ihrem Standort aus nicht optimiert.
Amerika
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)