How to convert a .PNG file to a different size

3 次查看(过去 30 天)
I have existing .PNG file as an output from following:
%Plot I:
X=datenum(tvec_SDstart);
Y=Carr_Fvec/1e6;
Z=magSpectrumMat_dB;
Tstart_num=datenum(Tstart);
Tend_num=datenum(Tend);
%
[X, Y]=meshgrid(X,Y);
h=surf(X,Y,Z);
set(h,'EdgeColor','none')
%
grid off
axis tight
view([90 90]); %Set view angle as Top-Flat 2D plot
colormap(jet);
%
% Create title and label
ax=gca;
set(ax,'FontAngle','italic','FontSize',8,'XColor',[0.0784313753247261 0.168627455830574 0.549019634723663],'YColor',[0.0784313753247261 0.168627455830574 0.549019634723663]);
set(ax,'XDir','reverse','XTick',linspace(X(1),X(end),6),'XLim',[Tstart_num Tend_num]); % Set the plot with XLim between the user defined Tstart/Tend Time
datetick('x','HH:MM:SS.FFF','keepticks','keeplimits');
%
plotname_PSD = sprintf('PSD vs Time Collected on %s', datestr(Date));
title(plotname_PSD,'FontSize',16,'Color',[0.0784313753247261 0.168627455830574 0.549019634723663]);
xlabel('Time');
ylabel('Frequency (MHz)');
zlabel('Magnitude (dB)');
%
% Create colorbar
set(ax,'CLim',Plotscale);
colorbar;
%
% Print to PNG file
print(plotname_PSD, '-dpng');
%
Beside the file, I would like to convert to another long narrow PNG figure (w: 3 inches, L: 5.2 inches)
What is the best way to do this?

采纳的回答

Image Analyst
Image Analyst 2018-1-16
I think export_fig() lets you specify the saved image's rows and columns to get the size you want. https://www.mathworks.com/matlabcentral/fileexchange/23629-export-fig

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Discrete Data Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by