メインコンテンツ

delete

構文

説明

delete(a) は、指定された注釈を削除します。

すべて折りたたむ

この例では、vdp モデルで注釈をプログラムによって削除する方法を説明します。

例を開きます。次に、vdp モデルを開きます。

open_system('vdp')

At the top of the Van der Pol Equation model is an annotation with the text "Van der Pol Equation". Underneath is a second annotation displaying the equation.

モデル内の注釈のハンドルを取得するには、関数find_systemを使用します。

h = find_system(gcs,'FindAll','on','Type','annotation');

注釈を特定するには、注釈内のテキストをクエリします。

get_param(h,'PlainText')
ans = 3×1 cell
    {'Copyright 2004-2024 The MathWorks, Inc.'}
    {'Van der Pol Equation'                   }
    {'x_1' =x_2↵↵x_2' =µ(1-x_1^2) x_2 - x_1'  }

モデルの上部にある注釈 'Van der Pol Equation' を削除するには、2 番目のハンドルに対応するSimulink.Annotationオブジェクトを取得します。

an = get_param(h(2),'Object');

モデルから注釈を削除します。

delete(an)

Van der Pol Equation model without the annotation at the top that says "Van der Pol Equation"

モデル内の注釈のハンドルを取得します。次に、注釈内のテキストをクエリします。

h1 = find_system(gcs,'FindAll','on','Type','annotation');
get_param(h1,'PlainText')
ans = 2×1 cell
    {'Copyright 2004-2024 The MathWorks, Inc.'}
    {'x_1' =x_2↵↵x_2' =µ(1-x_1^2) x_2 - x_1'  }

'Van der Pol Equation' というテキストの注釈がモデルからなくなりました。

入力引数

すべて折りたたむ

注釈。Simulink.Annotation オブジェクトとして指定します。

バージョン履歴

R2006a より前に導入