필터 지우기
필터 지우기

Button for choose language-guide

조회 수: 3 (최근 30일)
john
john 2012년 3월 12일
Hi,
how can I define any flag (picture) to bushbutton or how to put any picture for example to the pushbutton?
Thank you

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2012년 3월 13일
H2pushbutton = ... from somewhere where you create the pushbutton you get and keep the handle.
% To set the picture:
set(H2pushbutton,'cdata',yourimage)
HTH
  댓글 수: 3
Bjorn Gustavsson
Bjorn Gustavsson 2012년 3월 13일
Somewhere you create the pushbutton uicontrol. Something like
uicontrol('...
Make sure to do that with a variable on the left-hand side:
H2pushbutton = uicontrol('...
That way you get a handle variable to that uicontrol that you can use to get and set its properties. Try:
get(H2pushbutton)
...to get a listing of the properties you can set.
"yourimage" is simply my whimsical variable-name of the image you want to set the uicontrol icon to. You have to load it somehow, don't you?
HTH,
Bjorn Gustavsson
Bjorn Gustavsson 2012년 3월 13일
H2thisthatorthenext is just a simple mnemonic for "handle to this that or the next". For future ease of code maintenance make good use of descriptive variable names, in my experience it doesn't really matter if you mix different styles a bit (_ as a word separator, camel-case etc) but it really helps to have names that are descriptive in some explicit way.

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

추가 답변 (1개)

Jan
Jan 2012년 3월 12일
You can set the 'CData' property of the uicontrol:
rgb = rand(10, 20, 3);
a = uicontrol('cdata', rgb);
  댓글 수: 3
Jan
Jan 2012년 3월 13일
GUIDE is a program to design GUIs, therefore you cannot insert a picture into it. The original question sounds, like you want to display a picture inside a pushbutton. If you want to get anything else, please explain this more detailed. What does "define a picture to pushbutton" exactly mean?
john
john 2012년 3월 13일
hi,
1. insert picture into pushbutton...if it is not possible, then
2. insert picture into guide

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

카테고리

Help CenterFile Exchange에서 Migrate GUIDE Apps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by