Reputation: 33864
I have an interesting problem in matlab. If i run the following code in a script and i run it by selecting it and pressing F9:
figure
subplot(4, 4, [1 2 5 6 9 10]);
plotGrid(spin1HGD, 2); % A function to plot a grid,
% essentially a bunch of patches.
campos([27.8504 -39.0203 71.3373]);
axis equal
I get the following figure:
now if i immediately run axis equal
, it actually does it:
Here is a screenshot of my matlab terminal:
So i am definitely running axis equal
at the end of the script and then I am having to actually manually run it for it to work.
Annoyingly, I cant reproduce it in anything but this code? What is the deal?
Upvotes: 3
Views: 735
Reputation: 1215
As suggested, adding drawnow
before axis equal
will fix this problem.
To reproduce the issue, run this code in a script:
figure
subplot(4, 4, [1 2 5 6 9 10]);
patch(rand(3), rand(3), [1 0 1])
campos([27.8504 -39.0203 71.3373]);
% drawnow
axis equal
then type 'axis equal' in the command window and notice that the plot changes.
Upvotes: 2