MATLAB: How to make a caption or title for the figure legend in MATLAB

captiondwhhgwaitlegendMATLABtitle

I would like to add a title for my legend within a figure in MATLAB

Best Answer

Since MATLAB R2016a this can be achieved by using the 'title' command described in the following documentation page:
For releases prior to MATLAB R2014b, a title for a legend can be added using the following commands:
hl = findobj(gcf,'Tag','legend');
hl_t = get(hl,'Title');
set(hl_t,'String','MyLegendTitle');
Note that this will only work with releases prior to R2014b.