View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from

Be the first to rate this file! 6 Downloads (last 30 days) File Size: 1.34 KB File ID: #43499 Version: 1.0



Chad Greene (view profile)


Query any number of graphics object properties at once using the get command.

| Watch this File

File Information

This function is aimed at reducing redundant typing and taking a few lines out of your scripts. If you want to get any number n object properties (hence, nget) at once use

[varargout] = nget(h,varargin)

EXAMPLE: Reduce the following five lines of code down to one:
xlim = get(gca,'xlim');
ylim = get(gca,'ylim');
zlim = get(gca,'zlim');
font = get(gca,'fontname');
kids = get(gca,'children');

Using nget:
[xlim,ylim,zlim,font,kids] = nget(gca,'xlim','ylim','zlim','fontname','children');

Required Products MATLAB
MATLAB release MATLAB 8.0 (R2012b)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (2)
13 Sep 2013 Chad Greene

Chad Greene (view profile)

Sven, that's brilliant! I think I may just adopt your method because scripts are always more portable and sharable when they don't rely on custom functions. Thanks for the suggestion!

Comment only
13 Sep 2013 Sven

Sven (view profile)

Chad, the situation wasn't quite as bad as your example described. You can get all those props in two lines rather than 5:

props = get(gca,{'xlim','ylim','zlim','fontname','children'});
[xlim,ylim,zlim,font,kids] = props{:};

You may at least want to update the internals of your function to use this syntax rather the loop, which can become costly if you try getting lots of props at once using your nget().

Comment only

Contact us