I'm trying to plot a 2d finite element solution and am plotting triangle-by-triangle like so:
for i=1:K
figure(1)
fill3(x,y,z,c)
hold on
end
The problem with this is that when I run the code, it literally draws them all in real time so I can see each triangle being drawn. What I want it to just have the finished figure pop up once it's all done.
My friend has coded the same thing except she's not having this issue at all and we can't find any differences in the code. My computer is very fast so it's not an issue of lag. I'm thinking maybe there's a setting in MATLAB that I'm missing?
Edit: I found the problem. Apparently, putting 'figure(1)' inside the loop makes a huge difference. I timed it with 'tic' and 'toc' and it took 54 seconds with the 'figure(1)' label inside the loop and 2 seconds when it was moved just before the loop. Go figure...