Starting in MATLAB R2014b, figure handles are object handles where previously they were integers. Now to get the associated number for the figure, query the new Number property. For example, this code gets the number for the current figure.
n = get(gcf,'Number')
The Number property is the value displayed in the figure title bar.
You can refer to a figure by its integer number. For example, figure(2) makes the figure with a Number property value of 2 the current figure.