Lamp Indicator Multiple Conditions

Arin on 7 Mar 2023
Latest activity Reply by Arin on 10 Mar 2023

Currently the lamp indicator in my channel can only respond to one condition. How to let the lamp indicator respond to multiple conditions for example the lamp shows red colour when condition is 1 and the same lamp shows green colour when condition is 0?
Christopher Stapels
Christopher Stapels on 7 Mar 2023
Using the buit in widget, you cannot use more than one color change. However, with MATLAB visualizations, you can build your own visualization that could show as many colors as your monitor will take.
Have a look at the traffic monitor channel as an example. The visualization there does green, yellow, and red to indicate the traffic level.
If you want to make a circle, I found this code which cracks me up becasue it uses the rectangle function to make a circle.
radius = 6;
centerX = 30;
centerY = 40;
myColor=[0.2,0.8,0.9];
rectangle('Position',[centerX - radius, centerY - radius, radius*2, radius*2],...
'Curvature',[1,1],'FaceColor',myColor);
axis square;
You can change the face color setting based on the action you want to indicate.
Arin
Arin on 9 Mar 2023
Hi, thank you for your reply.
May I know how to let the MATLAB visualizations react to my input just like the built in widget?
Also, how to hide the x-axis and y-axis for the output from the code above?
Appreciate your help. Thanks.
Arin
Arin on 9 Mar 2023
Hi, I have figured out how to hide the axis, but still unable to let the circle change its colour according to my input.
Christopher Stapels
Christopher Stapels on 9 Mar 2023
To get your code to react to changes, use the React or timecontrol apps. You can see how to use them in this video or this doc page, or the doc pages for react and timeControl. Lots of good content there.
To get the color to change, edit the value of myColor.
i.e.
if channelVal > myThreshold
myColor=[0 0 1];
end
Arin
Arin on 10 Mar 2023
Thanks a lot