suraj
suraj

Reputation: 73

How to display counter values to a GUI via edit text boxes in MATLAB

I have written code for an object counter based on color using a webcam. Now the final values are three integers: r, b, and g.

I need to display those values in three edit text boxes.I did this by using the following:

r=get(handles.rcount,'string');

(my algorithm)
r=r+1;
set(handles.rcount,'string',r);

Now when I execute the program, it starts with 0, and the next value it displays is 49, even though I increment by only 1. How do I fix this?

Upvotes: 2

Views: 2240

Answers (1)

Navan
Navan

Reputation: 4477

You need to convert r to a string before setting it on the edit box. See functions like num2str or int2str. char(49) is 1.

Upvotes: 3

Related Questions