How to put a picture on a button in a GUI?
62 ビュー (過去 30 日間)
古いコメントを表示
Hi,
I wish to create a GUI to use with a SIMULINK model. I want to have a picture on my buttons in my GUI. How do I do this?
Thanks,
Jasmine
1 件のコメント
Adam Danz
2020 年 10 月 20 日
Update: starting in r2020a uibuttons can also host animated GIF images and truecolor image arrays (examples).
採用された回答
TAB
2012 年 8 月 9 日
編集済み: TAB
2012 年 8 月 9 日
See
In these examples, image is read every time when GUI is created or opened. So image file must be present every time.
If you are using GUIDE to to design your GUI, you can embed the image directly in the button so that image file is not required again, here is the procedure:
- Double click on button to open Property inspector
- Go to CDATA property and enter the command imread('MyImageFile.jpg') . So image will be read and will be saved in fig file directly.
- After that deleting the original image will not have any effect on your GUI.
4 件のコメント
Lam Nguyen Van
2020 年 4 月 19 日
Help me! How can i do it: CDATA : I create code files that generate GUIs as functions or scripts (programmatic GUI construction)?
Lam Nguyen Van
2020 年 4 月 19 日
I want to After that deleting the original image will not have any effect on your GUI.
その他の回答 (3 件)
Raxeee
2013 年 1 月 29 日
"he command imread('MyImageFile.jpg') . So image will be "
So where is the location of MyImageFile.jpg on the hard disk.
Please clarify.
Jonathan Siliézar
2017 年 10 月 3 日
Hi, thanks for the information, it was very helpful. Once I've loaded the .jpg image to the push button (I'm trying to create an icon with basic info for the user on how to use the program) the image is very large, how do I resize it to fit the push button's dimensions? Thanks in advance.
0 件のコメント
Sujith Roy
2018 年 11 月 15 日
Can you adjust the position of the icon in the button?
This command works - imread('MyImageFile.jpg').
But how do I position the image to the left and then add some text on the button?
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!