0

What's the field axes in the last line of the following code?

function drawBox2D(h,object)

% draw regular objects
if ~strcmp(object.type,'DontCare')

  rectangle('Position',pos,'EdgeColor',occ_col{object.occlusion+1},...
            'LineWidth',3,'LineStyle',trun_style{trc},'parent',h(1).axes)
  rectangle('Position',pos,'EdgeColor','b', 'parent', h(1).axes)

See the h(1).axes in the last line? I don't know what is the h, don't know what to pass to that function. I speculate it to be a graph handle. So I tried h = figure(2); drawBox2D(h, obj);

However the handle itself is an integer so there's no field called 'axes'.

Could anyone tell me who does the field axes belong to? And what should I pass as h into this function?

SolessChong
  • 3,370
  • 8
  • 40
  • 67
  • It is something like this http://stackoverflow.com/q/3938348/1018966 – Sandesh Dec 14 '13 at 12:19
  • 1
    Whomever wrote that function, wants the first input to be a structure with a subfield called axes. So, you need to do smt like `s.axes = gca`, and then call `drawBox2D(s,...)` – Oleg Dec 14 '13 at 12:42

1 Answers1

0

If you want to get all axes handles anywhere in Matlab, you can do the following things:

allAxes = findall(0,'type','axes');

To select only axes handles not legends, you need to cleanup the list of axes

axNoLegendsOrColorbars= ax(~ismember(get(ax,'Tag'),{'legend','Colobar'}));
Sandesh
  • 1,190
  • 3
  • 23
  • 41