このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。
image
ブロック マスク アイコンにイメージを表示する
説明
image(
は、ブロック マスク アイコンにイメージ maskImage
)maskImage
を表示します。
image(
は、ブロック マスク アイコン内のイメージの位置とサイズを指定します。maskImage
,positionAndSize
)
image(
は、イメージをアイコンと共に回転させるか静止したままにするかを指定します。maskImage
,positionAndSize
,rotation
)
例
ブロック マスク アイコンでのイメージの表示
このマスク ブロックでは複数の image コマンドを使用してブロックの機能を示しています。
ブロック マスク アイコンは次の 4 つの別個のイメージで構成されています。
ブロック マスク アイコンの中央にあるイメージ。
block_icon_controller.png
に格納されています。右下の会社ロゴ。
company_logo.png
に格納されています。ブロックのコードをコンパイルおよびビルドできることを示す、左下にある 2 つのアイコン。
block_capability_compile.png
とblock_capability_build.png
に格納されています。
次のコードを使用して、ブロック マスク アイコンにイメージを表示します。
% 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]);
入力引数
maskImage
— ブロック マスク アイコンに表示するイメージ
行列 | 文字ベクトル | string スカラー
ブロック マスク アイコンに表示するイメージ。次のオプションのいずれかとして指定します。
RGB 値の "m"×"n"×3 の配列。ここで、"m" と "n" はピクセル単位でのイメージのサイズです。
イメージ ファイルの名前。string スカラーまたは文字ベクトルとして指定します。
メモ
.cur
、.hdf4
、.ico
、.pcx
、.ras
、.xwd
の形式のイメージは、ブロック マスクのイメージとして使用できません。
例: image('icon.jpg')
データ型: matrix
| string
| char
positionAndSize
— イメージの位置とサイズ
centre (既定値) | 数値配列 | string スカラー
イメージの位置とサイズ。[x, y, w, h]
という形式の数値配列として指定します。
x
— アイコンの左下隅からのイメージの水平方向の変位。アイコンの合計幅のパーセンテージとして指定します。y
— アイコンの左下隅からのイメージの垂直方向の変位。アイコンの合計高さのパーセンテージとして指定します。w
— イメージの幅。アイコンの合計幅のパーセンテージとして指定します。h
— イメージの高さ。アイコンの合計高さのパーセンテージとして指定します。
これらの値を使用した場合、ブロックのサイズを変更したときに、イメージのサイズはブロック マスク アイコンのサイズに合わせてスケーリングされません。表に示しているように position
を指定することもできます。
イメージの位置
値 | ブロック マスク アイコン内の位置 |
---|---|
"center" | 中央 |
"top-left" | 左上隅 |
"bottom-left" | 左下隅 |
"top-right" | 右上隅 |
"bottom-right" | 右下隅 |
例: image('company_logo.png',[95,2,10,10])
例: image("block_icon_controller.png","center")
データ型: array
| string
| char
rotation
— イメージをアイコンと共に回転させるオプション
'off'
(既定値) | 'on'
アイコンが回転するときに、イメージも回転するのか静止したままなのかを指定するオプション。'off'
または 'on'
として指定します。
例: image('company_logo.png',[95,2,10,10],'off')
バージョン履歴
R2006a で導入
MATLAB コマンド
次の MATLAB コマンドに対応するリンクがクリックされました。
コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。
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)