Graphics on pushbuttons for gUI's

2 Ansichten (letzte 30 Tage)
Jason
Jason am 9 Okt. 2015
Kommentiert: Jason am 9 Okt. 2015
Hi, Im trying to put an image onto a push button. However, I seem to be missing something.
Heres my attempt.
Al=imread('LeftArrow.png');
a(:,:,1) = Al;
a(:,:,2) = Al;
a(:,:,3) = Al;
set(handles.pushbuttonLEFT,'CData',a)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 9 Okt. 2015
Your png file is RGB, so Al is already 3 dimensional. When you try to assign the 3 dimensional array to the two dimensional array a(:,:,1) you are going to fail.
  3 Kommentare
Walter Roberson
Walter Roberson am 9 Okt. 2015
If you have the appropriate toolbox you can imresize() what you send into CData.
Jason
Jason am 9 Okt. 2015
Thankyou

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Entering Commands finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by