I woluld like to plot a image on any push button or toggle button
can you pls guide me.

 Respuesta aceptada

Gerd
Gerd el 7 de Jul. de 2011

0 votos

Hi murali,
open GUIDE.
Place a button on the gui.
Go to the callback function
logo = imread('Logo.jpg','jpg');
image(logo);
Gerd

8 comentarios

Paulo Silva
Paulo Silva el 7 de Jul. de 2011
Sorry Gerd but that won't work
Jan
Jan el 7 de Jul. de 2011
@Gerd: Murali asks for drawing the image onto the button, not for drawing an image, if the button is pressed. Well, at least Paulo and me think that this is the question.
Gerd
Gerd el 7 de Jul. de 2011
Mmmh now that I read the question again.
Paulo Silva
Paulo Silva el 7 de Jul. de 2011
The only question I see is if we can help him but instead of wasting my time saying Yes I rather post a link to something that might help him.
Gerd
Gerd el 7 de Jul. de 2011
I don't see your point Paulo. As Jan already said he wanted to draw an image on a button. I didn't interpret the question correct.
The sad thing about it is that mostly we don't get any feedback.
Paulo Silva
Paulo Silva el 7 de Jul. de 2011
Gerd you are not the only one that failed to understand something, I often do the same. The user was polite and said what he wanted and we guided him, hope he's happy with the answers.
Murali Mohan
Murali Mohan el 7 de Jul. de 2011
Hi Gerd,Paulo
thanks for the answer.:)
Apart from that I have added
[X map] = imread('up_button.gif');
iconU = ind2rgb(X,map);
set(handles.pushbutton,'CData',iconU);
Paulo Silva
Paulo Silva el 7 de Jul. de 2011
Murali Mohan you accepted the wrong answer but thanks for posting the solution you chosen.

Iniciar sesión para comentar.

Más respuestas (2)

Jan
Jan el 7 de Jul. de 2011

1 voto

Another approach:
pic = fullfile(tempdir, 'picture.png');
uicontrol('Style', 'pushbutton', ...
'String', '
<<file-----pic--.>>
');

Categorías

Más información sobre Convert Image Type en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 7 de Jul. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by