필터 지우기
필터 지우기

get title of subplot back

조회 수: 5 (최근 30일)
Max Müller
Max Müller 2014년 8월 8일
댓글: Max Müller 2014년 8월 8일
hey Guys, I have 9subplots in 1 figure and I want to give the User of my program the possibility to click of one subplot and get the title back....
do u have any tips ?

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2014년 8월 8일
close
x=repmat((1:10)',1,9);
y=rand(10,9);
for k=1:9
subplot(3,3,k);
plot(x(:,k),y(:,k));
title(sprintf('title%d',k))
end
%------The code-----------------------
h=flipud(findobj(gcf,'type','axes'))
%-----get title N°5----------------
n=5
g=get(h(n),'title');
title_5=get(g,'string')
  댓글 수: 2
Max Müller
Max Müller 2014년 8월 8일
Thanks....but ur "n" isnt a variable, which gets its value by clicking on the plot....its a variable the user needs to type in manuel.
Max Müller
Max Müller 2014년 8월 8일
Thanks

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Max Müller
Max Müller 2014년 8월 8일
편집: Max Müller 2014년 8월 8일
function main
Plot = figure set(Plot,'name','Plot','Tag','Plot','numbertitle','off');
for i = 1:9
a = rand(1,1) * 100
b = rand(1,1) * 3
x = 1:100
y = x.^b +a
subplot(5,2,i)
plot(x,y)
title([num2str(i)])
end
Data = findobj('type','axes');
disp('ok1')
disp(Data)
set(Data,'buttondownfcn',@click)
disp('ok2')
function click (gcbo,evendata,handles)
disp(gca)

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by