A good day everyone, I'd like to get some ideas on how to assign colour for a specific value on my static text box for GUI. Below is the coding I used to assign value to the static text box. But I don't know how to assign colour for the value. For example, a=50, colour of static text box becomes green. When a=60, colour of static text box becomes yellow. Thanks in advance.
set(ah,'handlevisibility','off','visible','off')
d= 500;
t= 10;
a= [num2str(d/t) 'km/h'];
set(handles.Speed,'String',a);
I created a function where the inputs
dandtand then it will make the figure where the background color of the text box changes based on the velocity (d/t). To convert the velocity to a color, I set up acolor_matrixvariable whose first column is the velocity and the next 3 columns are the red, green, and blue values needed to specify the color. You can add more rows to have more colors involved, such as going from red to yellow to green.Here is the result with a velocity of 50:
Here is the result with a velocity of 60
You can also interpolate and extrapolate, although you can't go too far.