Reputation: 65
I have been struggling with this issue for quite a long time. I have the following code:-
y = -16.55 : 0.01: 16.55;
xpos = 10.5361 * cos(y/10.5361) * (pi/20);
x = [-xpos,xpos];
y = [y,-y];
a1 = subplot(1,4,1);
fill(x,y,'r');
a2 = subplot(1,4,2);
fill(x,y,'g');
a3 = subplot(1,4,3);
fill(x,y,'o');
a4 = subplot(1,4,4);
fill(x,y,'w');
set(a1,'Units','centimeters','Position',[0 0 5 36]);
set(a2,'Units','centimeters','Position',[5.5 0 5 36]);
set(a3,'Units','centimeters','Position',[11 0 5 36]);
set(a4,'Units','centimeters','Position',[16.5 0 5 36]);
This code produces 4 subplots. Now I need to export the whole figure (not just what appears on the screen) in exact dimensions (as pointed by the data cursor in the figure) to pdf from MATLAB. Please suggest how to do. I went through the following link but not of much help:-
MATLAB: print a figure to pdf as the figure shown in the MATLAB
Please suggest a solution.
Upvotes: 1
Views: 1277
Reputation: 156
Exporting figures in matlab can be very painful... For me it was until i discovered this:
http://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig
It exports as pdf or eps, the whole figure under display (it removes blank borders)... Have you tried it?
export_fig file_name.pdf and it is done!
Upvotes: 1