[心得] 利用matlab轉圖檔至eps的方法

看板LaTeX (論文排版)作者 (橋)時間15年前 (2010/04/24 00:53), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串1/1
相信這個版很多人會因為要寫論文 因此需要將圖檔轉成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

04/24 16:40, , 1F
未用先推
04/24 16:40, 1F
文章代碼(AID): #1BqT2Png (LaTeX)
文章代碼(AID): #1BqT2Png (LaTeX)