2つの画像を待機時間毎に繰り返し出力すると画像がちらつきます。対策を教えてください。
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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
以上、よろしくお願いします。
0 commentaires
Réponse acceptée
Tohru Kikawada
le 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
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Downloads dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!