I made a script which uses
set(gca,'property','value','property2','value2')
and changes the default plot to look nicer.
Now, if you mean to say you have a figure with an axes, and h is the axes handle defined by one code. I believe you could do two things to get h from another piece of code. One is to set h as an output in the original code:
function h = myhandlefunction
h = plot(1:5);
end
then it will be in the work space if you call another function:
function another_function
h=myhandlefunction;
set(h,'color','yellow')
end
As long as you don't close the figure or delete the object that the handle references, this should work. You can also use findobj:
h = findobj(gca,'color','b');
set(h,'color','yellow')
to search for specific handles with matching properties. I hope I answered your question, good luck :)
2 Comments
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/39428-how-to-save-access-an-axes-s-properties-using-the-handles-structure#comment_81595
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/39428-how-to-save-access-an-axes-s-properties-using-the-handles-structure#comment_81595
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/39428-how-to-save-access-an-axes-s-properties-using-the-handles-structure#comment_81600
Direct link to this comment
https://se.mathworks.com/matlabcentral/answers/39428-how-to-save-access-an-axes-s-properties-using-the-handles-structure#comment_81600
Sign in to comment.