How can I let the surf function in matlab to wait for user prompt before showing up the figure.

2 ビュー (過去 30 日間)
I am trying to plot an array using the surf function in matlab. Everytime I try to use this function, it spits all the figures at once. Is there a way that I can let the program wait each time to spit the next figure.
Thank you in advance any help would be appreciated.
  2 件のコメント
Rik
Rik 2019 年 1 月 27 日
What do you mean with 'all the figures'? The surf function only outputs a single plot, unless you call it repeatedly.
What is your context?
Raza
Raza 2019 年 1 月 27 日
my functions are a & b and I have a cell array 13x1 for both 'a' and 'b'. So it produces thirteen figures all at once. I just want it to prodcue it one by one or atleast a way to go back and forth easily instead of clicking different figure windows again and again. I have the following code.
for m=1:13
figure;
surf(a{m});
surf(b{m});
end

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

採用された回答

Rik
Rik 2019 年 1 月 28 日
This code should solve it. Your second call to surf would replace the first, so I put in a call to subplot. You could also plot the two surfaces in the same axis by calling hold on after the first surf.
for m=1:13
figure
subplot(1,2,1)
surf(a{m});
subplot(1,2,2)
surf(b{m});
f=msgbox('Click OK to continue to next figure');
uiwait(f)
end

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by