Based on your description of the issue, my guess is that:
- Your figure is fairly complicated.
- Which means that exporting into a vector format is going to both take a really long time, and potentially create a really large PDF file.
- This means that exportgraphics is going to run fairly slowly.
- And you are probably trying to open the resulting PDF file before it is done being generated.
- If you force MATLAB to stop early, it is leaving a partially written (and thus corrupt) PDF.
But, this is all speculation without knowing more details about what is in your figure.
What do you have plotted in your figure that you are exporting?
Can you describe (in as much detail as you want);
- What objects are you plotting (surfaces, patches, lines, scatter plots, etc.)?
- How many objects are you plotting?
- Roughly how many data points are you plotting?
Actual reproduction steps would be better, but not necessary.
A screenshot of your figure could also really help.