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

 채택된 답변

Gerd
Gerd 2011년 7월 7일

0 개 추천

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

댓글 수: 8

Paulo Silva
Paulo Silva 2011년 7월 7일
Sorry Gerd but that won't work
Jan
Jan 2011년 7월 7일
@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 2011년 7월 7일
Mmmh now that I read the question again.
Paulo Silva
Paulo Silva 2011년 7월 7일
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 2011년 7월 7일
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 2011년 7월 7일
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 2011년 7월 7일
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 2011년 7월 7일
Murali Mohan you accepted the wrong answer but thanks for posting the solution you chosen.

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

추가 답변 (2개)

Jan
Jan 2011년 7월 7일

1 개 추천

Another approach:
pic = fullfile(tempdir, 'picture.png');
uicontrol('Style', 'pushbutton', ...
'String', '
<<file-----pic--.>>
');
Paulo Silva
Paulo Silva 2011년 7월 7일

0 개 추천

카테고리

도움말 센터File Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

질문:

2011년 7월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by