フィルターのクリア

How to convert a .PNG file to a different size

3 ビュー (過去 30 日間)
Ivy Chen
Ivy Chen 2018 年 1 月 16 日
回答済み: Image Analyst 2018 年 1 月 16 日
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 Center および File ExchangeDiscrete Data Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by