gca function in matlab
显示 更早的评论
I have read the matlab docs but I don't understand what gca really does. Can somebody explain it to me? Thanks!
采纳的回答
更多回答(1 个)
Salaheddin Hosseinzadeh
2014-8-20
Hi Civs,
To my knowledge whenever an object is created (figure, window, axes, function,...) a handle is associates to the object it's like when you want do define a number value, you assign it to a variable,
a = 2;
when you create a figure, axes and ... you can assign them to a variable(handle)
h = figure()
I = axes()
so when you want to plot on a specific axes, let's say you have 10 figures and axes open, and you want to plot on an axes you previously names regression
regression = axes(); % this creates an axes and name it regression
plot(regression,x,y); % this plots on the axes named regression not the other ones
to find which axis is currently viewing or which one is recently clicked (viewed), or more programmatically speaking has the focus, you can use gca which gives you the handle(assume it as variable) to the current figure.
read more about handles it's useful.
类别
在 帮助中心 和 File Exchange 中查找有关 Graphics Object Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!