why open figure new window!

I use serial connection matlab:
function BytesAvailable_Callback(obj,event)
global hand;
data=fscanf(obj,'%d',1);
t=clock;
set(hand.uitable1,'data',data);
axes(hand.axes1);
plot(t(6),data);
and before i had write in funtion_OpeningFcn:
global hand;
hand = handles;
guidata(hObject, handles);
result: uitable1 display data received but axes1 no. And open figure new window!
thanks!

답변 (2개)

Walter Roberson
Walter Roberson 2013년 1월 17일

0 개 추천

Try changing
axes(hand.axes1);
plot(t(6),data);
to
plot(hand.axes1, t(6), data);
Image Analyst
Image Analyst 2013년 1월 17일

0 개 추천

If you do not already have a figure open with an axes on it called axes1, then it will probably open a new figure. Why does this callback not have handles as the third argument? Did you use GUIDE?

댓글 수: 2

leo
leo 2013년 5월 7일
I'm in final project and encounter the same problem, but in my profet, I want to display an image in an axes: when I code:
function BytesAvailable_Callback(obj,event)
global hand;
global ind;
ind = fscanf(obj)
axes(hand.image)
imshow('anh.jpg');
But it alway open in new window? Could you help me? Please.
Image Analyst
Image Analyst 2013년 5월 8일
It should not - there is no call to figure. Are you using GUIDE? If so, why is handles not in the callback argument list? What is hand? Print out, or check on, the value of hand.image and make sure it's the same floating point number each time, like 178.012 or whatever. If it's the same number it should go to the same axes.

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

카테고리

도움말 센터File Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

질문:

2013년 1월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by