I want to implement an input UE ID (edit1) will display an ellipse on axes.
But I want to have only one ellipse on axes.
For example: when I enter UE ID 5 and press pushbutton, and then enter UE ID 6 and press pushbutton, axes only show the ellipse of UE ID 6.
How can I modify it?
function pushbutton2_Callback(hObject, eventdata, handles)[UELocation] = textread('observe/mdUELocationforGUI2.txt');InputUEID = get(handles.edit1,'String');InputUEID = str2double(InputUEID);InputUEID3 = InputUEID+1;[Pairlink] = textread('observe/mdPairlinkforGUI2.txt');Node_ID = Pairlink(InputUEID3,4); %NodeID
Node_ID2 = Node_ID+1;[UEBeamAngle] = textread('observe/mdUEHBeamAngleforGUI2.txt');angles_Panel_0 = UEBeamAngle;[NodeBeam] = textread('observe/mdNodeBeamforGUI2.txt');Node_beamnumber = NodeBeam(1,3);[NodeBeamAngle] = textread('observe/mdNodeBeamHAngleGUI2.txt'); angles = NodeBeamAngle + 60; axes(handles.axes1)hold onxUECenter=UELocation(InputUEID3,2);yUECenter=UELocation(InputUEID3,3);[Nodelocation] = textread('observe/mdNodeLocationXY_axisforGUI2.txt');ROIX = Nodelocation(1,5);ROIY = Nodelocation(1,6);axis([0 ROIX 0 ROIY])a = 25*ROIX/1000; %The length and width of the ellipse
b = 25*ROIX/1000;r = a;LineSpec='b';plot_ellipse(a,b,r,xUECenter,yUECenter,angles_Panel_0,LineSpec)xNodeCenter=Nodelocation(Node_ID2,2);yNodeCenter=Nodelocation(Node_ID2,3);r = a;LineSpec='k';plot_ellipse(a,b,r,xNodeCenter,yNodeCenter,angles,LineSpec)axis equalfunction plot_ellipse(a,b,r,xNodeCenter,yNodeCenter,angles,LineSpec) % Draw ellipse function
%write documentation here explaing inputs and usage
hEllipse = imellipse(gca,[-a, -b, 2*a, 2*b]); xy = hEllipse.getVertices();delete(hEllipse)x = xy(:,1);y = xy(:,2);xy = [x y];for k = 1 : length(angles) theta = angles(k); rotationArray = [cosd(theta) sind(theta); -sind(theta) cosd(theta)]; rotated_xy = xy * rotationArray; xCenter = xNodeCenter + (r - 0.25) * cosd(theta); yCenter = yNodeCenter + (r - 0.25) * sind(theta); x = rotated_xy(:,1) + xCenter; y = rotated_xy(:,2) + yCenter; plot(x, y, LineSpec); if k == 1 grid on; hold on; endend
Best Answer