If i create a figure with a certain name:
hFig = figure('Name','ALL CAMERAS', 'Resize','on', 'Position',[600 600 400 800],'numbertitle','off');
How can I call it at different time to add subplots to it. I have tried
figure(hFig);
montageImg = cell2mat(allImgs);
J = imadjust(montageImg,stretchlim(montageImg),[0 1]);
subplot(3,2,1);
imshow(J);
I will vary the last digit in subplot to plot to each of the 6 positions allocated for. But currently, it just opens up a new figure called "ALL CAMERAS" for each subplot I do rather than plot all to the same figure?
Is it also possible to delete all open figures except the one called ALL CAMERAS?
Thanks

 採用された回答

Guillaume
Guillaume 2014 年 10 月 5 日

1 投票

Your algorithm should work. The imshow should appear in the subplot you've specified. Is this really the code you're using?
As for deleting all figures but hfig:
close(setdiff(findall(0,'Type','figure'), hfig)); %or you could use findobj

その他の回答 (1 件)

Image Analyst
Image Analyst 2014 年 10 月 5 日

1 投票

It should not do that. Do you have it in a loop that iterates 6 times? It should not matter but put the figure(hFig) outside the loop. Which line of code is the line that actually creates the new figure?
Are these color or gray scale images? Why not just do
imshow(montageImg, []);
instead of all that stuff with J?

2 件のコメント

Jason
Jason 2014 年 10 月 6 日
Yes it was in the loop, once taken out it works. Thanks
Image Analyst
Image Analyst 2014 年 10 月 6 日
I'm glad my suggestion fixed it (you can vote for it if you want to give "reputation points"), but I'm still not sure why it worked. It should not have made any difference with the code you posted as long as you were passing in hFig and hFig had the same numerical value each time.

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

カテゴリ

ヘルプ センター および File ExchangeGraphics Performance についてさらに検索

質問済み:

2014 年 10 月 5 日

コメント済み:

2014 年 10 月 6 日

Community Treasure Hunt

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

Start Hunting!

Translated by