Call a figure to show just like a variable

73 ビュー (過去 30 日間)
Kosta
Kosta 2017 年 1 月 18 日
編集済み: Stephen23 2017 年 1 月 18 日
Hello,
I have a project, where in my matlab script I have to create lots of figures. Every time I run the script the figures show either all together or one on top of the other etc.
I would like to know how can I suppress a specific figure from showing, so that every time I run the script I don't end up with many different figures, and also be able to call a figure just like a variable, to show whenever I desire by name.
For example if I set a=10, I can call a as a variable whenever I desire in the command window. Can I do the same with a figure? (i have looked in to the set and gcf, however I did not find exactly what I was looking for there)
Thanks in advance for your help,
Kosta.

採用された回答

Stephen23
Stephen23 2017 年 1 月 18 日
編集済み: Stephen23 2017 年 1 月 18 日
Use the figure handle:
fgh = figure(...)
Using the handle you can set and get and properties of the figure (such as Position, Visible, etc), or delete it altogether. Note that all graphics objects have handles like this, and that if you want to write robust, fast code then you need to specify these handles explicitly:
fhg = figure(...);
axh = axes(fgh,...);
lnh = plot(axh,...);
and then later you can much faster access their properties. Graphics objects and their handles are introduced very well in the documentation:
You will also find hundreds of tutorials online that introduce and explain graphics handles.
Note that every object has properties that you can access using this handle, e.g.:
My advice would be to use just one figure (or just a few), and access all of its component parts explicitly using their handles. Simply delete, add, replace, move, or update their values using their handles.
  3 件のコメント
Kosta
Kosta 2017 年 1 月 18 日
Never mind, I got it with a slightly different way. Thanks again.
Stephen23
Stephen23 2017 年 1 月 18 日
編集済み: Stephen23 2017 年 1 月 18 日
To hide a figure:
set(fgh,'Visible','off')

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by