Background Color of a Pushbuton
Show older comments
Hi! I have an array of 5 elements of 1's and 0's, for example A[0,0,0,1,1] and I have 5 pushbuttons I created. What I want to do is have a simple loop that checks for the ones and zeros in my array and change the corresponding background color of my pushbutton. Right now I want them to change to green if it is a '0' and red if it is a '1'. I am just unfamiliar with Matlab syntax, here's my thought process:
For(int i=0, i<6, i++){ if(A[i]==1) set(pushbutton + i, 'backgroundcolor', 'red') else set(pushbutton + i, 'backgroundcolor', 'green')}
any hints on what i'm dong wrong would be greatly appreciated!
Answers (0)
Categories
Find more on Creating, Deleting, and Querying Graphics Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!