Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
update text

Subject: update text

From: wahyoe Unggul

Date: 22 May, 2011 19:33:03

Message: 1 of 6

how to update the text on "plot3" using the checkbox

plotbutton_callback(hObject, eventdata, handles)
.....
plot3(x,y,z...................)
......
checkboxStatus = get(handles.checkbox1,'Value');
                if checkboxStatus==1 %if box is checked, set text in object
                    text(.........................)
                else%if box is unchecked, delete text in object
                end
whether the placement is correct checkbox on?

Subject: update text

From: ImageAnalyst

Date: 22 May, 2011 19:44:05

Message: 2 of 6

I don't know what this means "whether the placement is correct
checkbox on" but it looks like your code snippet should work. Are you
having trouble with it? If so, perhaps you snipped too much out of it
so we can't really see the problem.

Subject: update text

From: wahyoe Unggul

Date: 22 May, 2011 20:07:05

Message: 3 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <3e6f5a8d-ea94-4fec-b9c7-869e3af3d198@d28g2000yqf.googlegroups.com>...
> I don't know what this means "whether the placement is correct
> checkbox on" but it looks like your code snippet should work. Are you
> having trouble with it? If so, perhaps you snipped too much out of it
> so we can't really see the problem.

sorry
perhaps an outline of questions I like this

plotbutton_callback(hObject, eventdata, handles)
t = 0:0.1:10*pi;
x = exp(-t/20).*cos(t);
y = exp(-t/20).*sin(t);
z = t;
axes (handles.axes1)
hold on
plot3(x,y,z);
checkboxStatus = get(handles.checkbox1,'Value');
if checkboxStatus==1 %if box is checked, set text in object
  text(.........................)
  else%if box is unchecked, delete text in object
 end

how to create and delete text on the axes using the checkbox?

Subject: update text

From: ImageAnalyst

Date: 22 May, 2011 20:40:04

Message: 4 of 6

Use text() to put up text.

To delete text, use this:

h = findobj(gca,'Type', 'text');
if ~isempty(h)
delete (h);
end

Subject: update text

From: wahyoe Unggul

Date: 22 May, 2011 22:23:03

Message: 5 of 6

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <724d79a3-7224-4b6a-8f1c-e9a1b0541fb9@z13g2000yqg.googlegroups.com>...
> Use text() to put up text.
>
> To delete text, use this:
>
> h = findobj(gca,'Type', 'text');
> if ~isempty(h)
> delete (h);
> end

plotbutton_callback(hObject, eventdata, handles)
t = 0:0.1:10*pi;
x = exp(-t/20).*cos(t);
y = exp(-t/20).*sin(t);
z = t;
axes (handles.axes1)
hold on
plot3(x,y,z);
checkboxStatus = get(handles.checkbox1,'Value');
if checkboxStatus==1 %if box is checked, set text in object
  text(.........'FontSize',8,...
                    'HorizontalAlignment','center','Color','black');
  else%if box is unchecked, delete text in object
h = findobj(gca,'Type', 'text');
                delete(h)
 end

sorry image, check not work update text in axes1,

Subject: update text

From: wahyoe Unggul

Date: 22 May, 2011 22:45:05

Message: 6 of 6

"wahyoe Unggul" <wahyoe_slipnot@yahoo.co.id> wrote in message <irc2c7$l0f$1@newscl01ah.mathworks.com>...
> ImageAnalyst <imageanalyst@mailinator.com> wrote in message <724d79a3-7224-4b6a-8f1c-e9a1b0541fb9@z13g2000yqg.googlegroups.com>...
> > Use text() to put up text.
> >
> > To delete text, use this:
> >

thanks, image
after several attempts, finally checkbox to work :)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us