Call a figure to show just like a variable

77 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Interactive Control and Callbacks 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by