what should i do when i click on button i want to show the value of variable in axes

조회 수: 2 (최근 30일)
i declare a variable and want to show its value when user click on button what should i do? my code is
function pushbutton5_Callback(hObject, eventdata, handles)
global mor
cc = bwconncomp(mor,4);
number = cc.NumObjects;
no i want to show the value of number?
any method?suggest me please.
Walter Roberson expecting some help from you.

채택된 답변

Walter Roberson
Walter Roberson 2016년 5월 2일
text(X, Y, num2str(number))
for appropriate X and Y coordinates.
However, since the number does not relate to any one object, consider something like
title(sprintf('There were %d objects', number))
  댓글 수: 5
sana saleeme
sana saleeme 2016년 5월 3일
it generate error while evaluating UIcontrol Callback
Walter Roberson
Walter Roberson 2016년 5월 3일
Please post the complete text of the error message, and also the current version of your function.
It would also be better if you rewrote to avoid using global variables. See

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Interactive Control and Callbacks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by