フィルターのクリア

How to hold on my figures in Matlab?

4 ビュー (過去 30 日間)
Obi Carwood
Obi Carwood 2019 年 5 月 26 日
コメント済み: Obi Carwood 2019 年 5 月 26 日
I have this piece of code:
N = 10
for i = 1:N
RandR = randi([1,40]);
RandC = randi([1,40]);
if step0(RandR,RandC,2) == 200
step0(RandR,RandC,1) = 255;
step0(RandR,RandC,[2,3]) = 0;
figure,
hold on
imshow(step0,'InitialMagnification','fit')
end
i;
end
And whenever I run it, it will not hold on my figure, and instead will produce a bunch of figures.
Am I doing something obviously wrong?
My intention is to randomly change the pixels of an image and watch this as a simulation. But instead it produces a few figures instead.

採用された回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2019 年 5 月 26 日
編集済み: KALYAN ACHARJYA 2019 年 5 月 26 日
Remove figure, it open the new figure in each iteration.
If you want to plot all response in same figure, use hold on after plot.
If you want imshow images in different window, you should use figure. in addition your code is not complete, step0 undefined.
Any isuue, let me know?
  2 件のコメント
Obi Carwood
Obi Carwood 2019 年 5 月 26 日
thanks mate. sorry, I had step0 defined on another tab.
Obi Carwood
Obi Carwood 2019 年 5 月 26 日
what if im not using plot at all? just an imshow?
i used your method and the simulation seemed to just take its time and only spit out the final product. Any way to be able to watch this simulation as it goes on?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by