固有のプロパティをもつグラフィックス オブジェクトの検索 - 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
Craigslist Stowe Vermont
boohoo : ANNUAL REPORT AND ACCOUNTS 2021
Ffxiv Act Plugin
Craigslist Monterrey Ca
Dricxzyoki
855-392-7812
Ross Dress For Less Hiring Near Me
Tv Guide Bay Area No Cable
1TamilMV.prof: Exploring the latest in Tamil entertainment - Ninewall
Sunday World Northern Ireland
Urinevlekken verwijderen: De meest effectieve methoden - Puurlv
Santa Clara Valley Medical Center Medical Records
Oscar Nominated Brings Winning Profile to the Kentucky Turf Cup
Johnston v. State, 2023 MT 20
House Party 2023 Showtimes Near Marcus North Shore Cinema
Bad Moms 123Movies
Samantha Lyne Wikipedia
Aberration Surface Entrances
How To Cancel Goodnotes Subscription
Ruben van Bommel: diepgang en doelgerichtheid als wapens, maar (nog) te weinig rendement
Ahrefs Koopje
Best Mechanics Near You - Brake Masters Auto Repair Shops
Grimes County Busted Newspaper
Sunset Time November 5 2022
Www.paystubportal.com/7-11 Login
Mals Crazy Crab
January 8 Jesus Calling
Mta Bus Forums
Marilyn Seipt Obituary
Rgb Bird Flop
*!Good Night (2024) 𝙵ull𝙼ovie Downl𝚘ad Fr𝚎e 1080𝚙, 720𝚙, 480𝚙 H𝙳 HI𝙽DI Dub𝚋ed Fil𝙼yz𝚒lla Isaidub
Babydepot Registry
Free Tiktok Likes Compara Smm
Myra's Floral Princeton Wv
Ravens 24X7 Forum
Wasmo Link Telegram
Gideon Nicole Riddley Read Online Free
Edict Of Force Poe
Go Smiles Herndon Reviews
Craigslist Boats Eugene Oregon
Thanksgiving Point Luminaria Promo Code
Mvnt Merchant Services
Legit Ticket Sites - Seatgeek vs Stubhub [Fees, Customer Service, Security]
Craigslist Mexicali Cars And Trucks - By Owner
Verizon Outage Cuyahoga Falls Ohio
About My Father Showtimes Near Amc Rockford 16
Craigslist en Santa Cruz, California: Tu Guía Definitiva para Comprar, Vender e Intercambiar - First Republic Craigslist
705 Us 74 Bus Rockingham Nc
Dolce Luna Italian Restaurant & Pizzeria
F9 2385
Goosetown Communications Guilford Ct
Intuitive Astrology with Molly McCord
Latest Posts
Article information

Author: Golda Nolan II

Last Updated:

Views: 6255

Rating: 4.8 / 5 (58 voted)

Reviews: 81% of readers found this page helpful

Author information

Name: Golda Nolan II

Birthday: 1998-05-14

Address: Suite 369 9754 Roberts Pines, West Benitaburgh, NM 69180-7958

Phone: +522993866487

Job: Sales Executive

Hobby: Worldbuilding, Shopping, Quilting, Cooking, Homebrewing, Leather crafting, Pet

Introduction: My name is Golda Nolan II, I am a thoughtful, clever, cute, jolly, brave, powerful, splendid person who loves writing and wants to share my knowledge and understanding with you.