固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj - MathWorks 日本 (2024)

固有のプロパティをもつグラフィックス オブジェクトの検索

ページ内をすべて折りたたむ

構文

h = findobj

h = findobj(prop,value)

h = findobj('-not',prop,value)

h = findobj(prop1,value1,oper,prop2,value2)

h = findobj('-regexp',prop,expr)

h = findobj('-property',prop)

h = findobj(prop1,value1,...,propN,valueN)

h = findobj(objhandles,___)

h = findobj(objhandles,'-depth',d,___)

h = findobj(objhandles,'flat',___)

説明

h = findobj は、グラフィックス ルート オブジェクトおよびそのすべての子孫を返します。

h = findobj(prop,value) は、プロパティ propvalue に設定された階層内のすべてのオブジェクトを返します。

h = findobj('-not',prop,value) は、指定したプロパティが指定した値に設定されていないすべてのオブジェクトを返します。

h = findobj(prop1,value1,oper,prop2,value2) は、論理演算子 operprop,value のペアに適用します。たとえば、h = findobj('LineStyle','--','-and','Marker','o') は破線スタイルをもつすべてのオブジェクトと円マーカーを返します。

h = findobj('-regexp',prop,expr) は、正規表現を使用して特定のプロパティ値をもつオブジェクトを検索します。正規表現を満たすプロパティ値をもつオブジェクトが返されます。

h = findobj('-property',prop) は、指定したプロパティをもつすべてのオブジェクトを返します。

h = findobj(prop1,value1,...,propN,valueN) は、指定したプロパティが指定した値に設定されている階層内のすべてのオブジェクトを返します。prop,value のペアを、前述の構文からの他の入力引数の組み合わせで置き換えることができます。たとえば、h = findobj(prop1,value1,'-not',prop2,value2,'-property',prop3) は次の 3 つの条件を満たすオブジェクトをすべて返します。

  • オブジェクトに value1 に設定されたプロパティ prop1 がある。

  • オブジェクトに値が value2 に設定されていないプロパティ prop2 がある。

  • オブジェクトにプロパティ prop3 がある。

h = findobj(objhandles,___) は、objhandles にリストされているオブジェクトと、そのすべての子孫に検索を制限します。前述の任意の構文に対して検索を制限できます。

h = findobj(objhandles,'-depth',d,___) は、objhandles にリストされているオブジェクトと、グラフィックス オブジェクト階層内で d レベル下までのその子孫に検索を制限します。

h = findobj(objhandles,'flat',___) objhandles のみにリストされているオブジェクトに検索を制限します。子孫オブジェクトは検索されません。'flat' オプションの使用は d = 0 を指定した '-depth' オプションを使用するのと同じです。

すべて折りたたむ

すべてのグラフィックス オブジェクトの検索

ライブ スクリプトを開く

既存の Figure をすべて削除してから、乱数値のプロットを作成します。

close allplot(rand(5))

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (1)

グラフィックス ルート オブジェクトおよびそのすべての子孫を返します。

h = findobj
h = 8x1 graphics array: Root Figure (1) Axes Line Line Line Line Line

すべての Line オブジェクトの検索

ライブ スクリプトを開く

既存のすべての Figure を削除してから、複数のプロットを作成します。

close allplot(magic(4))

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (2)

すべての Line オブジェクトを返します。

h = findobj('Type','line')
h = 4x1 Line array: Line Line Line Line

指定されたプロパティ値をもつオブジェクトの検索

ライブ スクリプトを開く

カスタムの色とライン スタイルを使用して 9 つの正弦波をプロットします。

x = linspace(0,7);y = ones(length(x),9);for i = 1:9 y(:,i) = sin(x-i/5)';endplot(x,y)colororder({'red','green','blue'})ax = gca;ax.LineStyleOrder = {'-','--',':'};

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (3)

赤い実線を返します。次に、ラインの太さを変更します。

h = findobj('Color','red','LineStyle','-')
h = Line with properties: Color: [1 0 0] LineStyle: '-' LineWidth: 0.5000 Marker: 'none' MarkerSize: 6 MarkerFaceColor: 'none' XData: [0 0.0707 0.1414 0.2121 0.2828 0.3535 0.4242 0.4949 0.5657 0.6364 0.7071 0.7778 0.8485 0.9192 0.9899 1.0606 1.1313 1.2020 1.2727 1.3434 1.4141 1.4848 1.5556 1.6263 1.6970 1.7677 1.8384 1.9091 1.9798 2.0505 2.1212 ... ] (1x100 double) YData: [-0.1987 -0.1289 -0.0586 0.0121 0.0827 0.1529 0.2224 0.2907 0.3576 0.4226 0.4856 0.5462 0.6040 0.6588 0.7103 0.7582 0.8024 0.8426 0.8785 0.9101 0.9371 0.9594 0.9769 0.9896 0.9973 1.0000 0.9977 0.9905 0.9782 0.9611 ... ] (1x100 double) Use GET to show all properties
h.LineWidth = 2;

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (4)

論理式を使用したオブジェクトの検索

ライブ スクリプトを開く

複数行プロットを作成します。各プロットの識別子を指定します。

x = linspace(-1,1);y1 = x;plot(x,y1,'Tag','linear')hold ony2 = x.^2;plot(x,y2,'Tag','quadratic')y3 = exp(x);plot(x,y3,'Tag','exponential')y4 = sin(x);plot(x,y4,'Tag','sinusoidal')hold off

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (5)

Tag プロパティが 'linear' に設定されていないすべてのオブジェクトを検索します。

h1 = findobj('-not','Tag','linear')
h1 = 6x1 graphics array: Root Figure (1) Axes Line (sinusoidal) Line (exponential) Line (quadratic)

Tag プロパティが 'linear' または 'quadratic' に設定されていないすべてのオブジェクトを検索します。

h2 = findobj('-not',{'Tag','linear','-or','Tag','quadratic'})
h2 = 5x1 graphics array: Root Figure (1) Axes Line (sinusoidal) Line (exponential)

Tag プロパティが 'linear' または 'quadratic' に設定されていないすべての Line オブジェクトを検索します。

h3 = findobj('Type','line','-not',{'Tag','linear','-or','Tag','quadratic'})
h3 = 2x1 Line array: Line (sinusoidal) Line (exponential)

'-and' と中かっこを使用して、前のステートメントの可読性を改善します。

h4 = findobj({'Type','line'},'-and',{'-not',{'Tag','linear','-or','Tag','quadratic'}})
h4 = 2x1 Line array: Line (sinusoidal) Line (exponential)

正規表現を使用したオブジェクトの検索

ライブ スクリプトを開く

3 つのライン プロットを作成し、そのうち 2 つのプロットに識別子を割り当てます。

x = linspace(-1,1);y1 = x;plot(x,y1)hold ony2 = x.^2;plot(x,y2,'Tag','Quadratic')y3 = exp(x);plot(x,y3,'Tag','Exponential')hold off

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (6)

空以外の Tag プロパティをもつすべてのオブジェクトを検索します。

h = findobj('-regexp','Tag','[^'']')
h = 2x1 Line array: Line (Exponential) Line (Quadratic)

指定されたプロパティをもつすべてのオブジェクトの検索

ライブ スクリプトを開く

4 つの値のベクトルを作成します。ライン プロット、面積プロット、および棒グラフを使用して値を表示します。

y = [1 5 6 3];subplot(3,1,1)plot(y)subplot(3,1,2)area(y)subplot(3,1,3)bar(y)

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (7)

BaseValue プロパティをもつすべてのオブジェクトを返します。

h = findobj('-property','BaseValue')
h = 2x1 graphics array: Bar Area

現在の座標軸内にあるすべての Line オブジェクトの検索

ライブ スクリプトを開く

乱数値のプロットを作成してから、現在の座標軸内の Line オブジェクトをすべて返します。

plot(rand(5))

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (8)

h = findobj(gca,'Type','line')
h = 5x1 Line array: Line Line Line Line Line

h を使用して最初の Line オブジェクトの y 値をクエリします。

values = h(1).YData
values = 1×5 0.6557 0.0357 0.8491 0.9340 0.6787

現在の Figure 内にあるすべてのオブジェクトの検索

ライブ スクリプトを開く

2 つのタブを含む Figure を作成します。各タブに親コンテナーを指定することで各タブに座標軸を追加します。1 番目のタブにライン、2 番目のタブに表面をプロットします。

figuretab1 = uitab('Title','Tab1');ax1 = axes(tab1);plot(ax1,1:10)tab2 = uitab('Title','Tab2');ax2 = axes(tab2);surf(ax2,peaks)

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (9)

現在の Figure 内にあるすべてのオブジェクトとその子孫を返します。

h = findobj(gcf)
h = 8x1 graphics array: Figure (1) TabGroup Tab (Tab1) Tab (Tab2) Axes Axes Line Surface

検索の深さの制限

ライブ スクリプトを開く

2 つのサブプロットを積み上げた Figure を作成します。

subplot(2,1,1)x = linspace(0,10);y1 = sin(x);plot(x,y1)subplot(2,1,2)y2 = sin(5*x);plot(x,y2)

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (10)

現在の Figure 内にあるすべてのオブジェクトとその子を検索します。

h1 = findobj(gcf,'-depth',1)
h1 = 3x1 graphics array: Figure (1) Axes Axes

現在の Figure 内にあるすべてのオブジェクトと、グラフィックス オブジェクト階層内で 2 レベル下までの子孫すべてを検索します。

h2 = findobj(gcf,'-depth',2)
h2 = 5x1 graphics array: Figure (1) Axes Axes Line Line

'flat' オプションを使用して、検索を現在の Figure および現在の座標軸に制限します。

h3 = findobj([gcf,gca],'flat')
h3 = 2x1 graphics array: Figure (1) Axes

入力引数

すべて折りたたむ

propプロパティ名
文字ベクトル | string スカラー

プロパティ名。文字ベクトルまたは string スカラーとして指定します。詳細については、グラフィックス オブジェクトのプロパティを参照してください。

例: 'Tag'

例: 'Type'

valueプロパティ値
スカラー | 配列

プロパティ値。スカラーまたは配列として指定します。

oper論理演算子
'-and' (既定値) | '-or' | '-xor'

論理演算子。'-and''-or'、または '-xor' として指定します。論理演算子の優先順位は、MATLAB® の優先順位規則に従います。詳細については、演算子の優先順位を参照してください。

演算子の優先順位を制御するには、cell 配列内で prop,value のペアをグループ化します。たとえば、Tag プロパティが 'button one' に設定され、Color プロパティが 'red''blue' 以外の値に設定されているすべてのオブジェクトを検索します。

h = findobj('Tag','button one','-and', ... '-not',{'Color','red','-or','Color','blue'})

expr正規表現
string 配列 | 文字ベクトル | 文字ベクトルの cell 配列

正規表現。string 配列、文字ベクトル、文字ベクトルの cell 配列として指定します。expr には、文字、メタ文字、演算子、トークンと、プロパティ値内で一致するパターンを指定するフラグを含めることができます。expr を使用できるのは、プロパティ値が string または文字ベクトルの場合のみです。正規表現についての詳細は、regexp を参照してください。

objhandles検索対象のオブジェクト
グラフィックス オブジェクトの配列

検索対象のオブジェクト。グラフィックス オブジェクトの配列として指定します。'-depth' オプションまたは 'flat' オプションを指定しない限り、findobj は入力配列 objhandles 内のオブジェクトと、グラフィックス オブジェクト階層内のそのすべての子孫を検索します。

d検索深度
非負の整数

検索深度。入力配列 objhandles 内の任意のオブジェクトから下のレベル数を示す非負の整数として指定します。

  • d = nobjhandles 内の各オブジェクトから n レベル下の階層を検索します。

  • d = 0objhandles 内のオブジェクトと同じレベルのみを検索します。これは、'flat' オプションを指定することと等価です。

  • d = infobjhandles 内のオブジェクトから下の全レベルを検索します。これは、'-depth' オプションまたは 'flat' オプションを指定しない既定の検索と等価です。

ヒント

  • あるオブジェクトで HandleVisibility プロパティが 'off' に設定されている場合、findobj はそのグラフィックス オブジェクトやその子孫を返しません。非表示のオブジェクトを含め、階層内のすべてのオブジェクトを返すには、関数 findall を使用します。

  • 関数 findobj は、すべての正しいプロパティ値に正確に一致するオブジェクトを検索します。たとえば、このコードは Color プロパティが redr、または [1 0 0] に設定されたすべてのオブジェクトを検索します。

    findobj('Color','r')
  • グラフィックス オブジェクトが、objhandles で識別される複数のオブジェクトの子孫である場合、関数 findobj がそのハンドルを検出するたびに MATLAB によってオブジェクトが検索されます。そのため、グラフィックス オブジェクトへの暗黙的な参照では、オブジェクトが複数回返される可能性があります。

バージョン履歴

R2006a より前に導入

参考

copyobj | findall | findobj | gcf | gca | gcbo | gco | get | regexp | set | groot

トピック

  • オブジェクトの検索
  • グラフィックス オブジェクトの階層

MATLAB コマンド

次の MATLAB コマンドに対応するリンクがクリックされました。

 

コマンドを MATLAB コマンド ウィンドウに入力して実行してください。Web ブラウザーは MATLAB コマンドをサポートしていません。

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj- MathWorks 日本 (11)

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:

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
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
  • 日本 (日本語)
  • 한국 (한국어)

Contact your local office

固有のプロパティをもつグラフィックス オブジェクトの検索 - MATLAB findobj
- MathWorks 日本 (2024)
Top Articles
How Long Does a Warrant Stay Active in Utah?
Chattanooga TN hourly weather forecast
The Advantages of Secure Single Sign-on on the BenQ Board
Hub.vacation Club.com
FPL tips and team of the week: Eze, Fernandes and Mateta should shine this week
Google Jobs Denver
Get maximum control with JCB LiveLink | JCB.com
10 Tips for Making the Perfect Ice for Smoothies
Retail Space For Rent Craigslist
Dsw Designer Shoe Warehouse Ann Arbor Photos
Creglist Tulsa
Wjbd Weather Radar
Dr Frita Mcrae Fisher Husband
Fire And Ice Festival Dc
What does JOI mean? JOI Definition. Meaning of JOI. OnlineSlangDictionary.com
Henry Ford Hospital: Ein Meisterwerk von Frida Kahlo
Precision Garage Door Long Island
Telegraph Ukraine podcast presenter David Knowles dies aged 32
Ropro Cloud Play
Real Estate Transfers Erie Pa
Endocriene systeemklieren
Who Is Denise Richards' Husband? All About Aaron Phypers
The 15 Best Things to Do in Branson, Missouri
Walgreens Dupont Tonkel
The Woman King Showtimes Near Cinemark 14 Lancaster
Pwc Transparency Report
Csgo Themed Inventory
Wayne State Dean's List
Carefirst.webpay.md
Spaghetti Models | Cyclocane
New Jersey Map | Map of New Jersey | NJ Map
Experience the Convenience of Po Box 790010 St Louis Mo
Yillian Atkinson Velez
Math Mystery Case Of The Snowman Army Answer Key
Rolling-Embers Reviews
Southland Goldendoodles
Patient Portal Bayfront
Guide for The Big Con
Tires Shop Santoyo
Huskersillustrated Husker Board
O'reilly's In Mathis Texas
Cvs On 30Th And Fowler
Plusword 358
Lindy Kendra Scott Obituary
Ces 2023 Badge Pickup
CDER - UTENLANDSKE og NORSKE artister
Ev Gallery
Gasmonkeygarage.com Cars For Sale
Black Panther Pitbull Puppy For Sale
Best Of Clinton Inc Used Cars
Thekat103.7
Sicilys Pizza Promo Code 40 Off
Latest Posts
Article information

Author: Madonna Wisozk

Last Updated:

Views: 5652

Rating: 4.8 / 5 (68 voted)

Reviews: 91% of readers found this page helpful

Author information

Name: Madonna Wisozk

Birthday: 2001-02-23

Address: 656 Gerhold Summit, Sidneyberg, FL 78179-2512

Phone: +6742282696652

Job: Customer Banking Liaison

Hobby: Flower arranging, Yo-yoing, Tai chi, Rowing, Macrame, Urban exploration, Knife making

Introduction: My name is Madonna Wisozk, I am a attractive, healthy, thoughtful, faithful, open, vivacious, zany person who loves writing and wants to share my knowledge and understanding with you.