Close all hang after linking many subplot axes

I am working on a project for which I create several plots with linked axes. When I try to close all the figures, I am seeing MATLAB hang for several minutes. I have traced it to having the axes linked. If I do not link the axes, close-all does not cause the program to freeze. Is there perhaps a better way to do this that would not result in MATLAB hanging?
I have tried to make the plots in both 2013a and 2012a and both have the same issue. Here is a code snippet which recreates the issue:
clc clear close all
y = rand(100000,1);
x = 1:100000;
hand = [];
for i = 1:100
figure;
hand(end+1) = subplot(1,1,1);
plot(x,y)
end
linkaxes(hand,'x')
tic
close all
toc % Takes more than 35 seconds to close all

Answers (0)

Asked:

on 14 Apr 2015

Edited:

on 14 Apr 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!