MATLAB: GUI red circle indicating connection

circleguiindicator

I have serial connection. I would like to have a green circle blinking in the screen while connection is on and a red circle while connection is off.
do i need to use axes for that?

Best Answer

Personally I would do it with axes yes. Below an example of green and red circle depending on parameter x.
x = [0 1];
for i =1:numel(x)
rectangle('Position', [0.0 0.0 1 1], 'Curvature', [1 1], 'FaceColor', [x(i) 1-x(i) 0]) % with x = parameter
ax = gca;
% remove tick labels
set(ax,'XTick',[]),set(ax,'YTick',[])
% make lines of the axes white --> invisible on white background
set(ax,'XColor',[1,1,1]) , set(ax,'YColor',[1,1,1])
% make axes square to get round circle
axis square
pause(0.5)
end
Kind regards,
Baltam