2つの画像を待機時間​毎に繰り返し出力する​と画像がちらつきます​。対策を教えてくださ​い。

11 Ansichten (letzte 30 Tage)
Nagao
Nagao am 29 Jan. 2017
Bearbeitet: Jiro Doke am 30 Jan. 2017
2つの画像を待機時間毎に繰り返し出力すると画像がちらつきます。 1つの画像出力では問題ないですが、2つの画像出力ではちらつきます。 以下にサンプルコードを示します。 プログラム実行後、figure(1)とfigure(2)をドラッグ&ドロップで離してください。
T = timer('TimerFcn',@(~,~)disp('Fired.'),'StartDelay',0.5);
for i=1:1:30
figure(1)
z=ones(100);
image(z)
figure(2)
z=ones(100);
image(z)
start(T)
wait(T)
end
使用しているPCは、windows7、プロセッサ:xeon(r) CPU E5-2609 0,メモリ:64GB
以上、よろしくお願いします。

Akzeptierte Antwort

Tohru Kikawada
Tohru Kikawada am 30 Jan. 2017
"ちらつき"は figure がそれぞれアクティブになり、前面に移動するため発生していると思います。
figure 自体は操作せずに、直接 image のハンドラーを経由して値を変更することができます。
下記のコードをお試しください。
T = timer('TimerFcn',@(~,~)disp('Fired.'),'StartDelay',0.5);
figure(1);
z=rand(100,100,3);
h1 = image(z);
figure(2);
z=rand(100,100,3);
h2 = image(z);
for i=1:1:30
z1 = rand(100,100,3);
h1.CData = z1;
z2 = rand(100,100,3);
h2.CData = z2;
start(T)
wait(T)
end
このようなオブジェクトのプロパティへのアクセスは下記のヘルプが参考になります。 https://www.mathworks.com/help/matlab/creating_plots/access-and-modify-property-values.html

Weitere Antworten (0)

Kategorien

Mehr zu Downloads finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by