필터 지우기
필터 지우기

how to reuse the line after delete or hide

조회 수: 3 (최근 30일)
singh
singh 2015년 6월 10일
답변: Walter Roberson 2015년 6월 10일
suppose i plot line
BK=line([X,DCH_coord(1)],[Y,DCH_coord(2)],'marker','*','MarkerSize',10);
BK2=line([XX,DCH_coord(1)],[YY,DCH_coord(2)],'marker','*','MarkerSize',10);
for i=1:4
%sender to receiver
set(BK,'color','r','LineWidth',3),pause(.4)
set(BK,'color','k','LineWidth',3),pause(.4)
set(BK2,'color','r','LineWidth',3),pause(.4)
set(BK2,'color','k','LineWidth',3),pause(.4)
delete(BK); %for deleting the line
delete(BK2); % for deleting the line
%reverse receiver to sender
set(BK2,'color','r','LineWidth',3),pause(.4)
set(BK2,'color','k','LineWidth',3),pause(.4)
set(BK,'color','r','LineWidth',3),pause(.4)
set(BK,'color','k','LineWidth',3),pause(.4)
delete(BK2); %for deleting the line
delete(BK); % for deleting the line
end
after deleting first tym in the for loop if i again access BK and BK2 then it show error how to solve it please help me.if not delete then plz give me another solution to hide the lines after sender to receiver part and after receiver to sender.
thanks in advance.

채택된 답변

Walter Roberson
Walter Roberson 2015년 6월 10일
Set the line Visible property 'on' or 'off'

추가 답변 (1개)

Ingrid
Ingrid 2015년 6월 10일
try setting the linestyle to none so that the line becomes invisible instead of deleting it
than you can still use the handle in a subsequent call, just set the linestyle again to '-' to make it visible

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by