That error is thrown by the mlreportgen as you have closed the Fig1(line 48: close(gcf);), you can remove the error by not closing the figure window or you can save Fig1 as a Document part as shown below:
%% Gray value image
figure();
ax = gca;
Fig1 = Figure(surf(ax, picture_data));
%Plot the measurement data as surf plot
axis equal
shading interp
colorbar
view(0,-90)
Fig1 = getImpl(Fig1,report);
add(s1, p1);
add(s1,Fig1);
Also while saving Fig2 please use the below format so that your figures aren’t overwritten while generating the report:
Fig2 = Figure(imshow(groups_rgb));