findall
모든 그래픽스 객체 찾기
설명
h = findall(
는 objhandles
)objhandles
의 그래픽스 객체와 그 후손을 모두 반환합니다. findall
함수는 findobj
와 달리 HandleVisibility
속성이 'off'
로 설정된 경우에도 객체를 반환합니다.
예제
가시적 핸들 또는 숨겨진 핸들이 있는 Figure 찾기
Figure를 3개 만듭니다. 마지막 Figure의 HandleVisibility
속성을 'off'
로 설정합니다.
f1 = figure; f2 = figure; f3 = figure('HandleVisibility','off');
그래픽스 객체 계층 구조에 있는 가시적 핸들 또는 숨겨진 핸들의 개수를 표시합니다. 사용자마다 결과는 여기에 표시된 것과 다를 수 있습니다.
h1 = findall(groot); disp(numel(h1))
4
보이는 Figure 또는 숨겨진 Figure를 모두 찾습니다.
h2 = findall(groot,'Type','figure')
h2 = 3x1 Figure array: Figure (3) Figure (2) Figure (1)
findobj
함수를 사용하여 Figure를 찾으려고 시도하면 MATLAB®은 f1
과 f2
만 반환합니다.
h3 = findobj('Type','figure')
h3 = 2x1 Figure array: Figure (2) Figure (1)
숨겨진 핸들이 있는 객체 찾기
Figure 내에 있는 Text
객체에는 숨겨진 핸들이 있습니다. findall
을 사용하여 숨겨진 핸들을 반환합니다.
플롯이 있는 Figure를 만듭니다. 그런 다음 x축 레이블을 만듭니다.
plot(1:10)
txt = xlabel('My x-axis label');
txt
의 HandleVisibility
속성이 'off'
로 설정되어 있는지 확인합니다.
txt.HandleVisibility
ans = 'off'
findall
을 사용하여 x축 레이블의 Text
객체를 반환합니다.
h1 = findall(gcf,'Type','text')
h1 = Text (My x-axis label) with properties: String: 'My x-axis label' FontSize: 11 FontWeight: 'normal' FontName: 'Helvetica' Color: [0.1500 0.1500 0.1500] HorizontalAlignment: 'center' Position: [5.5000 0.4452 -1.0000] Units: 'data' Use GET to show all properties
Text
객체는 숨겨져 있으므로 findobj
함수를 사용하여 찾을 수 없습니다.
h2 = findobj(gcf,'Type','text')
h2 = 0x0 empty GraphicsPlaceholder array.
Text 객체 찾기
findall
을 사용하여 모든 Text
객체 또는 특정 속성을 갖는 Text
객체를 반환합니다.
플롯이 있는 Figure를 만듭니다. 그런 다음, 좌표축에 레이블을 지정하고 제목을 추가합니다. 제목의 색을 파란색으로 설정합니다.
plot((1:10).^2) xlabel('x') ylabel('y') title('y = x^2','Color','b')
현재 Figure에 있는 모든 Text
객체를 반환합니다.
h1 = findall(gcf,'Type','text')
h1 = 3x1 Text array: Text (y = x^2) Text (x) Text (y)
이번에는 모든 파란색 Text
객체를 반환합니다.
h2 = findall(gcf,'Type','text','Color','b')
h2 = Text (y = x^2) with properties: String: 'y = x^2' FontSize: 11 FontWeight: 'bold' FontName: 'Helvetica' Color: [0 0 1] HorizontalAlignment: 'center' Position: [5.5000 100.7725 0] Units: 'data' Use GET to show all properties
입력 인수
objhandles
— 검색될 객체
그래픽스 객체로 구성된 배열
검색될 객체로, 그래픽스 객체로 구성된 배열로 지정됩니다. findall
은 입력 배열 objhandles
에 있는 객체와 그 후손을 그래픽스 객체 계층 구조에서 모두 검색합니다.
예: h = findall(groot)
는 그래픽스 객체 계층 구조에 있는 가시적 핸들과 숨겨진 핸들을 모두 반환합니다.
prop
— 속성 이름
문자형 벡터 | string형 스칼라
속성 이름으로, 문자형 벡터 또는 string형 스칼라로 지정됩니다. 자세한 내용은 그래픽스 객체 속성 항목을 참조하십시오.
예: h = findall(gcf,'Type','text')
는 현재 Figure에서 Type
속성이 'text'
로 설정된 모든 객체를 반환합니다.
value
— 속성값
스칼라 | 배열
속성값으로, 스칼라 또는 배열로 지정됩니다.
팁
findall
에서 사용할 검색 설정을 사용자 지정하기 위해objhandles
뒤에findobj
함수의 입력값 조합이 오도록 할 수 있습니다. 예를 들면 다음과 같습니다.h = findall(groot,prop1,value1,'-not',prop2,value2,'-property',prop3)
버전 내역
R2006a 이전에 개발됨
MATLAB 명령
다음 MATLAB 명령에 해당하는 링크를 클릭했습니다.
명령을 실행하려면 MATLAB 명령 창에 입력하십시오. 웹 브라우저는 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)