Opening a saved fig file in R2014b is very slow when axes are linked

2 views (last 30 days)
Spotted some unusual behaviour recently. If I create a figure with subplots (see below) and linkaxes, save it and then reopen it, it takes approx 15 mins to open the fig, with one processor on my machine being used at 100% for all of that time. The figure opens in about a 1s if linkaxes isn't used. This behaviour isn't seen in older releases (I tried it in 09a). I assume it is a problem with linkaxes but wondered if anyone had a bright idea for a work around (other than ensuring axes aren't linked before saving!)? Linked and unlinked versions of the figure as generated on my machine attached.
Thanks,
Paul.
data=rand(6,10000);
figure
for i=1:6
ax(i) = subplot(6,1,i);
plot(data(i,:))
end
linkaxes(ax)

Accepted Answer

Anish Mitra
Anish Mitra on 23 Feb 2016
It looks like this might have been a reported bug, that has been fixed. You could try and check if the issue still persists in R2015a.
For R2014b, a workaround could be to not link axes before saving, but create a custom script that opens the figure and links the axes.
% Open the figure and save the handle in f
f = openfig('yourfigure.fig');
% Get the children of the figure
c = f.Children;
% This compares the children "type" with "axes" to get the correct indices
idx = strcmp(get(c,'type'),'axes')
% Get these axes from the figure's children
a = c(idx);
% Link the axes
linkaxes(a,'x');

More Answers (0)

Categories

Find more on Interactive Control and Callbacks in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!