Main Content

このページの内容は最新ではありません。最新版の英語を参照するには、ここをクリックします。

Push Button

ボタンを使用してパラメーターまたは変数の値を変更

  • Push Button block

ライブラリ:
Simulink / Dashboard

説明

Push Button ブロックを使用して、シミュレーション前またはシミュレーション中に、接続された変数またはパラメーターの値を変更します。ボタンを押している間のみに値が変更されるように、またはボタンをもう一度クリックするまで値の変更がラッチされるようにボタンを設定できます。Push Button ブロックを他の Dashboard ブロックと共に使用して、モデルを制御する対話型のダッシュボードを作成します。

Push Button ブロックをダブルクリックしても、シミュレーション中やブロックが選択されているときは、そのダイアログ ボックスは開きません。ブロック パラメーターを編集する場合は、[プロパティ インスペクター] を使用するか、次のようにブロック ダイアログ ボックスを開くことができます。

  • ブロックが選択されておらず、モデルのシミュレーションが行われていないときに、ブロックをダブルクリックする。

  • ブロックを右クリックし、コンテキスト メニューから [ブロック パラメーター] を選択する。

Push Button のアイコン

ボタンのテキストと一緒に表示されるアイコンを Push Button ブロックに追加できます。基本形状、自動車関連のインジケーター、ワイヤレス アイコンを含む事前定義されたセットからアイコンを選択できます。または、独自のカスタム アイコンをアップロードできます。組み込みアイコンの完全なリストを含む詳細については、アイコン参照してください。

Push Button ブロックにアイコンを追加するときに、ブロックの状態に応じて色が変わるようにアイコンのオンの色とオフの色を設定し、ボタンのテキストを基準にしたアイコンの配置を指定できます。たとえば、この Push Button ブロックは、オンの色が明るい緑色に指定され、ボタンのテキストの左側に配置されている円形のアイコンを使用するように設定されています。

Push button block with a green circle icon to the left of the button text.

Push Button ブロックのアイコンの設定を使用して、モデル内でのブロックの外観を設定できます。ブロックの外観をさらにカスタマイズする場合は、Customizable Blocks ライブラリの Push Button ブロックを使用することを検討してください。Customizable Blocks ライブラリの Push Button ブロックは、カスタム アイコンの追加をサポートしますが、組み込みアイコンを含みません。

Dashboard ブロックの接続

Dashboard ブロックはモデル要素への接続に端子を使用しません。Dashboard ブロックを変数やブロック パラメーターに接続するには、接続モードを使用します。接続モードを使用すると、モデル内で Dashboard ブロックを接続するプロセスが簡単になり、特に複数のブロックを一度に接続する場合に便利です。Dashboard ブロックを 1 つ接続するには、ブロック ダイアログ ボックスの [接続] テーブルを使用することもできます。

ヒント

ノーマル モードとアクセラレータ モードのシミュレーション中にモデルで Dashboard ブロックの接続を変更できます。

メモ

Dashboard ブロックは、モデル ブロック線図を更新するまで変数に接続できません。Dashboard ブロックを変数に接続するか、モデルを開いてシミュレーションを実行するまでの間に変数の値を変更するには、Ctrl + D キーを使用してモデル ブロック線図を更新します。

接続モードに切り替えるには、接続する Dashboard ブロックをキャンバスで選択します。Simulink® ツールストリップに、選択したブロックのタイプの名前が付いたタブが表示されます。ブロックのタブで [接続] をクリックします。接続モードでは、ブロックを 1 つ以上選択すると、接続に使用できるパラメーターと変数のリストが表示されます。選択した Dashboard ブロックに接続する変数またはパラメーターをリストから選択します。

選択した変数またはブロック パラメーターの値が非スカラーである場合は、[接続] テーブルの下部にあるテキスト ボックスを使用して、Dashboard ブロックに接続する要素を指定します。ベクトル、行列、または配列の要素に接続するには、3 または (1,3) のように、要素のインデックスを指定します。バスまたは構造体の要素に接続するには、ドットを使用して階層内の各レベルを示し、最上位レベルは省略して、バスまたは構造体階層のコンテキストで要素を指定します。たとえば、選択した複合変数またはパラメーター内に入れ子にされている構造体またはバス a のスカラー要素 b に接続するには a.b と指定します。

別の Dashboard ブロックを接続するには、別の Dashboard ブロックで一時停止し、その上に表示される [接続] ボタンをクリックします。次に、モデル内で信号およびブロックを選択し、接続するモデル要素を選択します。

A Knob block from the Dashboard library is in connect mode. To the right of the Knob block is a Sine Wave block that connects to a Gain block that connects to an Outport block. To the right of the Outport block is the list of parameters and variables available for connection.

モデルで Dashboard ブロックの接続が完了したら、[ブロック] タブで [接続完了] をクリックします。

ヒント

ShowInitialText ブロック パラメーターをもつ関数 set_param を使用して、接続されていないブロックに表示されるメッセージを非表示にできます。ブロックを接続すると、メッセージも表示されなくなります。

パラメーターのログ記録

Dashboard ブロックに接続されている調整可能なパラメーターはシミュレーション データ インスペクターに記録されます。シミュレーション データ インスペクターでは、記録された信号データと共にパラメーター値を表示できます。UI を使用して、または関数Simulink.sdi.exportRunを使用して、シミュレーション データ インスペクターからパラメーター データをエクスポートすることで、MATLAB® ワークスペースでログ記録されたパラメーター データにアクセスできます。シミュレーション データ インスペクターの UI を使用したデータのエクスポートの詳細については、ワークスペースまたはファイルへのデータのエクスポートを参照してください。パラメーター データは Simulink.SimulationData.Parameter オブジェクトに格納され、エクスポートされた Simulink.SimulationData.Dataset の要素としてアクセスできます。

制限

  • Dashboard Scope ブロックおよび Display ブロックを除き、Dashboard ブロックは実数のスカラー信号にのみ接続できます。

  • ツールストリップは、パネル内にあるブロックをサポートしません。

  • コメントアウトされたブロックには、ブロック ダイアログの [接続] テーブルを使用して Dashboard ブロックを接続することはできません。コメント化されたブロックに接続モードを使用して Dashboard ブロックを接続した場合、ブロックのコメントを解除するまでは Dashboard ブロックに接続された値が表示されません。

  • Dashboard ブロックは参照モデル内のモデル要素には接続できません。

  • モデルの階層構造をシミュレーションすると、参照モデル内の Dashboard ブロックで更新は実行されません。

  • Dashboard ブロックは、ラピッド アクセラレータ シミュレーションをサポートしていません。

  • シミュレーション中に Dashboard ブロックを変数またはパラメーターに接続すると、その変数またはパラメーターのデータはシミュレーション データ インスペクターに記録されません。シミュレーション データ インスペクターに変数とパラメーターのデータを記録するには、シミュレーションを実行する前に Dashboard ブロックを変数またはパラメーターに接続します。

  • [既定のパラメーター動作][インライン] に設定してエクスターナル モードでモデルをシミュレーションするときに、Dashboard ブロックがパラメーターと変数の値を変更するように見える場合があります。ただし、その変更はシミュレーションに伝播されません。たとえば、Gain ブロックには Dashboard ブロックを使用して [ゲイン] パラメーターに加えられた変更が表示されますが、シミュレーションで使用された [ゲイン] 値は変更されません。

パラメーター

すべて展開する

接続

[接続] テーブルを使用して、制御する変数またはブロック パラメーターを選択します。ブロックを信号に接続するには、次のようにします。

  1. 1 つ以上のブロックを含むモデルで選択を行います。

  2. 接続する変数またはパラメーターを選択します。

    選択した変数またはブロック パラメーターの値が非スカラーである場合は、[接続] テーブルの下部にあるテキスト ボックスを使用して、Dashboard ブロックに接続する要素を指定します。ベクトル、行列、または配列の要素に接続するには、3 または (1,3) のように、要素のインデックスを指定します。バスまたは構造体の要素に接続するには、ドットを使用して階層内の各レベルを示し、最上位レベルは省略して、バスまたは構造体階層のコンテキストで要素を指定します。たとえば、選択した複合変数またはパラメーター内に入れ子にされている構造体またはバス a のスカラー要素 b に接続するには a.b と指定します。

  3. [適用] をクリックします。

モデルの理解とデバッグを容易にするために、シミュレーション中に Dashboard ブロックをモデルの変数とパラメーターに接続することができます。

メモ

[接続] テーブル内のワークスペース変数を確認するには、Ctrl+D を使用してモデル ブロック線図を更新します。

プログラムでの使用

Dashboard ブロックを調整可能なパラメーターまたは変数にプログラムによって接続するには、Simulink.HMI.ParamSourceInfo オブジェクトを使用します。Simulink.HMI.ParamSourceInfo オブジェクトには 4 つのプロパティが含まれます。このプロパティの一部は、Dashboard ブロックのパラメーターへの接続に適用され、一部は Dashboard ブロックの変数への接続に適用されます。特定の Dashboard ブロックは、パラメーターまたは変数のいずれかに接続しているため、一部のフィールドには接続に関する値が設定されていません。

ブロック パラメーター: Binding
型: Simulink.HMI.ParamSourceInfo
既定の設定: []

メイン

モデル内の Push Button ブロックに表示されるテキスト。

ヒント

ブロックの状態に応じて異なるテキストを表示するボタンを設計するには、Customizable Blocks ライブラリの Push Button ブロックを使用します。

プログラムでの使用

ブロック パラメーター: ButtonText
型: string または文字配列
既定の設定: 'Button'

ボタンが押されたとき、またはラッチされたときに、接続されているブロック パラメーターに割り当てられる値。

ヒント

[ブロック タイプ] パラメーターを使用して、クリックに対するブロックの対応を設定します。

  • モーメンタリ —ボタンを押している間のみ [オンの値] が適用されます。

  • ラッチ — ボタンをクリックしたときに状態の変更がラッチされ、もう一度クリックするまで [オンの値] が適用されます。

プログラムでの使用

ブロック パラメーター: OnValue
型: string または文字配列
既定の設定: '1'

クリックに対するボタンの応答を指定します。

  • モーメンタリ —ボタンを押している間のみ [オンの値] が適用されます。

  • ラッチ — ボタンをクリックしたときに状態の変更がラッチされ、もう一度クリックするまで [オンの値] が適用されます。

プログラムでの使用

ブロック パラメーター: ButtonType
型: string または文字配列
値: 'Momentary' | 'Latch'

ブロック ラベルの位置。ブロックがモデル内の要素に接続されている場合、ラベルは接続された要素の名前です。

プログラムでの使用

ブロック パラメーター: LabelPosition
型: 文字ベクトル
値: 'Hide' | 'Bottom' | 'Top'
既定の設定: 'Hide'

書式設定

ブロックの背景の不透明度。0 ~ 1 のスカラー値として指定します。

例: 0.5

プログラムでの使用

ブロック パラメーター: Opacity
タイプ: スカラー
既定の設定: 1

テキストを含むブロックの前景色。標準色のパレットから色を選択するか、カスタムの色を指定できます。

プログラムでの使用

ブロックの ForegroundColor パラメーターを値が 0 から 1 の間の 13 列の [r g b] ベクトルを定義する string または文字ベクトルとして指定します。

ブロック パラメーター: ForegroundColor
: 文字ベクトル | string
値: [r g b] ベクトル

背景色。標準色のパレットから色を選択するか、カスタムの色を指定できます。

プログラムでの使用

ブロックの BackgroundColor パラメーターを値が 0 から 1 の間の 13 列の [r g b] ベクトルを定義する string または文字ベクトルとして指定します。

ブロック パラメーター: BackgroundColor
: 文字ベクトル | string
値: [r g b] ベクトル

アイコン

ボタンのテキストと一緒にまたはボタンのテキストの代わりに表示されるアイコンを Push Button ブロックに追加できます。形状、自動車関連、ワイヤレスの組み込みアイコンから選択できます。または、独自のカスタム SVG ファイル、PNG ファイル、JPEG ファイルをアップロードしてアイコンとして使用できます。

アイコン オプションを表示するには、ブロック ダイアログ ボックスの [アイコン] タブで [アイコン タイプ] を選択します。独自のカスタム アイコンを使用するには、[カスタム][アイコン タイプ] として選択し、イメージ ファイルをアップロードします。

アイコンを追加する場合、以下のパラメーターを使用してアイコンの外観を設定できます。

  • アイコン配置 — ボタンのテキストを基準としたアイコンの配置

  • オンの色 — ブロックが押されるかラッチされ、[オンの値] が接続されているパラメーターに適用されているときのアイコンの色

  • オフの色 — ブロックが押されていないまたはラッチされていない状態で、[オンの値] が接続されているパラメーターに適用されていないときのアイコンの色

アイコンの [オンの色][オフの色] を指定するには、[アイコンの色をカスタマイズ] を選択しなければなりません。

形状アイコン

アイコン基本形状のライブラリ ブロック名プログラムで使用する値

Check1 icon: a check mark

Check1Check1

Check2 icon: a check mark with slightly curved lines

Check2Check2

Check3 icon: the outline of a check mark

Check3Check3

Check4 icon: a check mark with a divot along its outline

Check4Check4

Circle icon: a solid black circle

CircleCircle

Ex1 icon: a cross mark

Ex1Ex1

Ex2 icon: a cross mark with one curved line

Ex2Ex2

Ex3 icon: the outline of a cross mark

Ex3Ex3

Ex4 icon: a cross mark with a divot along the outline

Ex4Ex4

Face icon: the outline of a face with a closed mouth in a straight line

FaceFace

Frown1 icon: the outline of a face with an open downturned mouth

Frown1Frown1

Frown2 icon: the outline of a face with a closed downturned mouth

Frown2Frown2

Hexagon icon: a solid hexagon

HexagonHexagon

Pentagon icon: a solid pentagon

PentagonPentagon

Rectangle icon: a solid rectangle

RectangleRectangle

Smile1 icon: the outline of a face with an open upturned mouth

Smile1Smile1

Smile2 icon: the outline of a face with a closed upturned mouth

Smile2Smile2

Solid Face icon: a solid face with a closed mouth in a straight line

Solid FaceSolidFace

Solid Frown1 icon: a solid face with an open downturned mouth

Solid Frown1SolidFrown1

Solid Frown2 icon: a closed downturned mouth

Solid Frown2SolidFrown2

Solid Smile1 icon: a solid face with an open upturned mouth

Solid Smile1SolidSmile1

Solid Smile2 icon: a solid face with a closed upturned mouth

Solid Smile2SolidSmile2

Square icon: a solid square

SquareSquare

Triangle icon: a solid triangle

TriangleTriangle

自動車関連アイコン

アイコン自動車関連のインジケーター ランプのライブラリ ブロック名プログラムで使用する値

Adaptive Cruise Control icon: a speedometer with an arrow pointing to a tickmark and the silhouette of a car in the background

Adaptive Cruise ControlAdaptiveCruiseControl

Adaptive Cruise Control Failure icon: a speedometer with an exclamation mark next to it and the silhouette of a car in the background

Adaptive Cruise Control FailureAdaptiveCruiseControlFailure

Antilock Brake System icon: a circle labeled "ABS" in a set of parentheses

Antilock Brake SystemAntilockBrakeSystem

Battery icon: the outline of a battery with a plus symbol on the positive pole, and a negative symbol on the negative pole

BatteryBattery

Check Engine icon: the outline of an engine labeled "Check Engine"

Check EngineCheckEngine

Check Engine2 icon: the outline of an engine with the silhouette of a lightning rod on it and the word "CHECK" underneath it

Check Engine2CheckEngine2

Cruise Control icon: a speedometer with an arrow pointing to one of the tickmarks

Cruise ControlCruiseControl

Eco Mode icon: a solid leaf shape labeled "ECO"

Eco ModeEcoMode

Electronic Stability icon: a circle labeled "ESP" in a set of parentheses

Electronic StabilityElectronicStability

Engine icon: the silhouette of an engine

EngineEngine

Engine Coolant Temp icon: a thermometer with waves in the background

Engine Coolant TempEngineCoolantTemp

Engine Failure icon: the silhouette of an engine with an exclamation mark on it

Engine FailureEngineFailure

Engine Heating icon: the silhouette of an engine with three wavy arrows pointing upwards on it

Engine HeatingEngineHeating

Engine Oil icon: the silhouette of an oil can

Engine OilEngineOil

Exterior Bulb Failure icon: the silhouette of a glowing light bulb with an exclamation mark on it

Exterior Bulb FailureExteriorBulbFailure

Front Fog Light icon: the outline of a fog light lamp emitting rays of light to the left that are depicted as diagonal lines on top of a wavy vertical line that represents the fog

Front Fog LightFrontFogLight

Fuel icon: the silhouette of a gas pump with an arrow pointing left on it

FuelFuel

Hazards icon: the outline of a warning triangle

HazardsHazards

Headlamp Leveling icon: the outline of a lamp emitting rays of light with an arrow pointing clockwise above them and an arrow pointing counterclockwise below them

Headlamp LevelingHeadlampLeveling

High Beams icon: the outline of a lamp emitting horizontal rays of light

High BeamsHighBeams

Hill Descent Control icon: the outline of a car driving down a slope

Hill Descent ControlHillDescentControl

Lighting Switch icon: the silhouette of a glowing light bulb

Lighting SwitchLightingSwitch

High Beams icon: the outline of a lamp emitting rays of light that run diagonally downward

Low BeamsLowBeams

Parking Assistance icon: the letter "P" next to a solid triangle, and the "P" emits a detection signal represented as three curved lines aimed at the triangle

Parking AssistanceParkingAssistance

Rear Fog Light icon: the outline of a fog light lamp emitting rays of light to the right that are depicted as horizontal lines on top of a wavy vertical line that represents the fog

Rear Fog LightRearFogLight

Side Lights icon: the outline two lamps emitting rays of light to the left and right

Side LightsSideLights

Stability Control icon: the silhouette of a car with wavy lines behind it

Stability ControlStabilityControl

Stability Control Off icon: the silhouette of a car with wavy lines behind it and the word "OFF" underneath

Stability Control OffStabilityControlOff

Tire Monitor icon: the outline of the cross-section of a tire with an exclamation mark on it

Tire MonitorTireMonitor

Traction Control icon: the outline of the cross-section of a tire with the label "TC"

Traction ControlTractionControl

Traction Control Off icon: the outline of the cross-section of a tire with the label "TC" and a diagonal slash through the whole image

Traction Control OffTractionControlOff

Traction Control Failure icon: the outline of the cross-section of a tire with the label "TC" and an exclamation mark next to it

Traction Control FailureTractionControlFailure

Turn Signal Left icon: a solid arrow pointing left

Turn Signal LeftTurnSignalLeft

Turn Signal Right icon: a solid arrow pointing right

Turn Signal RightTurnSignalRight

ワイヤレス アイコン

アイコンアイコン名プログラムで使用する値

Network icon: the wireless internet connection icon

NetworkNetwork

Network No Signal icon: the wireless internet connection icon grayed out,with a crossed-out circle next to it

Network No SignalNetworkNoSignal

Network Transmission icon: a wireless internet tower

Network TransmissionNetworkTransmission

Network3G icon: the wireless internet connection icon with "3G" next to it

Network3GNetwork3G

Network4G icon: the wireless internet connection icon with "4G" next to it

Network4GNetwork4G

Network5G icon: the wireless internet connection icon with "4G" next to it

Network5GNetwork5G

ヒント

  • ツールストリップ内の [ボタン] タブを使用して、Push Button ブロックのアイコンを変更できます。

  • Push Button ブロックの外観をさらにカスタマイズする場合は、Customizable Blocks ライブラリの Push Button ブロックを使用して、独自のボタンを設計することを検討してください。

    Customizable Blocks ライブラリの Push Button ブロックは、カスタム アイコンの追加をサポートしますが、組み込みアイコンを含みません。

  • アイコンのオンの色とオフの色は、次の SVG 要素に適用できます。

    • altGlyph

    • circle

    • ellipse

    • path

    • polygon

    • rect

    • text

    • textPath

    • tref

    • tspan

プログラムでの使用

ブロック パラメーター: Icon
型: string | 文字ベクトル
既定の設定: 'Default'

ボタンのテキストを基準としたアイコンの配置。ボタンのテキストを指定しないと、アイコンは常にブロックの中央に配置されます。

プログラムでの使用

ブロック パラメーター: IconAlignment
型: string | 文字ベクトル
値: 'Left' | 'Right' | 'Top' | 'Bottom' | 'Center'
既定の設定: 'Left'

Push Button ブロックにアイコンを追加するときに、ブロックの状態を反映してアイコンの色が変わるようにオンの色とオフの色を指定できます。アイコンの [オンの色][オフの色] を使用して指定するには、[アイコンの色をカスタマイズ] を選択します。

プログラムでの使用

ブロック パラメーター: IconColor
型: string | 文字ベクトル
値: 'On' | 'Off'
既定の設定: 'Off'

Push Button ブロックにアイコンを追加するときに、ブロックの状態を反映してアイコンの色が変わるようにオンの色とオフの色を指定できます。[オンの色] は、ブロックが押されるかラッチされ、[オンの値] が接続されているパラメーターに適用されているときのアイコンの色を指定します。標準色のパレットから色を選択するか、カスタムの色を指定できます。

依存関係

[オンの色] パラメーターを有効にするには、[アイコンの色をカスタマイズ] を選択します。

プログラムでの使用

ブロックの IconOnColor パラメーターを値が 0 から 1 の間の、13 列の [r g b] ベクトルとして指定します。

ブロック パラメーター: IconOnColor
型: [r g b] ベクトル

Push Button ブロックにアイコンを追加するときに、ブロックの状態を反映してアイコンの色が変わるようにオンの色とオフの色を指定できます。[オフの色] は、ブロックが押されていないまたはラッチされていない状態で、[オンの値] が接続されているパラメーターに適用されていないときのアイコンの色を指定します。標準色のパレットから色を選択するか、カスタムの色を指定できます。

依存関係

[オンの色] パラメーターを有効にするには、[アイコンの色をカスタマイズ] を選択します。

プログラムでの使用

ブロックの IconOffColor パラメーターを値が 0 から 1 の間の、13 列の [r g b] ベクトルとして指定します。

ブロック パラメーター: IconOffColor
型: [r g b] ベクトル

ブロックの特性

データ型

double | half | integer | single

直達

いいえ

多次元信号

いいえ

可変サイズの信号

いいえ

ゼロクロッシング検出

いいえ

拡張機能

バージョン履歴

R2015a で導入

すべて展開する