作者bridge23 (桥)
看板LaTeX
标题[心得] 利用matlab转图档至eps的方法
时间Sat Apr 24 00:53:39 2010
相信这个版很多人会因为要写论文
因此需要将图档转成eps档案编译
之前爬文找方法 有人说可以利用matlab写几行code即可
但是我想很多人其实不知道如何写code (我就是其中之一)
这边提供程式码会与用matlab但不会转档的人 m 函式
函式引用於以下网站
http://www.cs.cmu.edu/~jkubica/code/matlabToEPS.html
===============分隔线======================================
将以下档案存成 convertToEPS.m 档
% convertToEPS(imgName,type)
% By Jeremy Kubica, 2001
%
% Uses Matlab to convert a image file into a EPS file.
% imgName - the name of the image file
% type - the file type
%
% Example: to convert file "sample.jpg" to "sample.esp"
% convertToEPS('sample','jpg');
% New file is saved as imgName.esp
function convertToEPS(imgName,type)
pic = imread(imgName,type);
[y x c] = size(pic)
figure('Units','Pixels','Resize','off',...
'Position',[100 100 x y],'PaperUnit','points',...
'PaperPosition',[0 0 x y]);
axes('position',[0 0 1 1]);
image(pic);
axis off
saveas(gcf,imgName,'epsc');
=============分隔线==============================
将此函式存档後 只需要将图档跟此m档案放在一起
输入
convertToEPS('图档档名','图档副档名');
即可
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 218.210.140.72
1F:推 JamesChen:未用先推 04/24 16:40