[x,y] = meshgrid(1:15,1:15);
z = peaks(15);
T = delaunay(x,y);
p = trisurf(T,x,y,z);
export_fig(p.Parent, "test.png");
does work as intended when used from within the command window or a regular matlab file, but it seems to enter an endless loop when used from within the live editor (a *.mlx file). The issue seems to be related to drawnow.
A possible workaround is to undock the figure before exporting. This does however prevent it from being shown in the output column of the live editor:
[x,y] = meshgrid(1:15,1:15);
z = peaks(15);
T = delaunay(x,y);
p = trisurf(T,x,y,z);
set(p.Parent.Parent, 'Visible', 'on');
export_fig(p.Parent, "test.png");
set(p.Parent.Parent, 'Visible', 'off');
For example,
does work as intended when used from within the command window or a regular matlab file, but it seems to enter an endless loop when used from within the live editor (a *.mlx file). The issue seems to be related to
drawnow
.A possible workaround is to undock the figure before exporting. This does however prevent it from being shown in the output column of the live editor:
Matlab version: 2022b