gca function in matlab
Mostrar comentarios más antiguos
I have read the matlab docs but I don't understand what gca really does. Can somebody explain it to me? Thanks!
Respuesta aceptada
Más respuestas (1)
Salaheddin Hosseinzadeh
el 20 de Ag. de 2014
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.
Categorías
Más información sobre Graphics Object Properties en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!