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);

1 件のコメント

huong
huong 2013 年 1 月 17 日
thank you! i had done.

サインインしてコメントする。

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 ExchangeInteractive 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