0
私が作業しているシミュレーションをタイマーに追加しようとしています。現時点では、私が望む場所に表示するタイマーを得ることができますが、数字を互いにクリアにすることはできません。つまり、お互いの上に積み重ねて、ゆっくりとしっかりした黒い混乱を作り出します。私はclf関数を実装しようとしましたが、それは全体のフィギュアをクリアします。タイマーのコードは次のとおりです。Matlab - プロット上のオブジェクトを更新する
HH = 0; MM = 0; SS = 0;
timer = sprintf('%02d:%02d:%02d',HH,MM,SS);
text(-450,450,timer); %% adjust location of clock in graph using the first two arguments: (x,y) coordinates
for t = 1:86400
SS = SS + 1;
if SS == 60
MM = MM + 1;
SS = 0;
end
if MM == 60
HH = HH + 1;
MM = 0;
end
timer = sprintf('%02d:%02d:%02d',HH,MM,SS); %% construct time string after all adjustments to HH, MM, SS
clf(f,'reset'); %% clear previous clock display
text(-450,450,timer); %% re-plot time to figure
if t == EventTimes(1)
uav1 = uav1.uavSetDestin([event1(2:3) 0]);
plot(event1(2),event1(3),'+')
hold on
end
if t == EventTimes(2)
uav2 = uav2.uavSetDestin([event2(2:3) 0]);
plot(event2(2),event2(3),'r+')
hold on
end
タイマー機能のみをリセットして正しく表示する方法はありますか?
:私たちはのような何かを得るあなたのコードでこれを統合
– BillBokeey