?? saveimg.m
字號:
function saveimg(fignr)% SAVEIMG: Checks and saves image for GUI% All the software included in this package is presented as is.% It may be distributed freely. The author can, however, not be% held responsible for any problems whatever.% % Designed by Johan Baeten.% Last updated: 22-03-2000% Johan.baeten@mech.kuleuven.ac.beglobal NEWIMAGENAMEglobal PATHNAMEglobal XSIZE;global YSIZE;global IMAGENAMEglobal MAPglobal MAINFIG[filename, PATHNAME]= uiputfile('*.pgm','Save As');filename = lower(filename);PATHNAME = lower(PATHNAME);if filename == 0, seterror(' ... cancelled.'); return;endlf = length(filename);ok = 0;if lf>4, if strcmp(filename(lf-3:lf),'.pgm'), if lf < 13, temp_filename = filename; ok = 1; else seterror(' Error: Filename to long.'); return; end endend if ~ok, for i =1:lf if filename(i) == '.', seterror(' Error: Incorrect filename.'); return; end end if lf<9, temp_filename = [filename,'.pgm']; else seterror(' Error: Filename to long.'); return endendseterror(' ... On this machine only ''.pgm'' supported.'); NEWIMAGENAME= temp_filename;fignr = MAINFIG;IMAGENAME = NEWIMAGENAME;pad = PATHNAME;len = length(IMAGENAME);fid = fopen([pad,IMAGENAME],'w');if (fid == -1), seterror(' ... Can''t create file.'); % this should never happenelse watchon; drawnow; if strcmp(IMAGENAME(len-2:len),'pgm'), fprintf(fid,'p5\n'); fprintf(fid,'%d ',XSIZE); fprintf(fid,'%d \n',YSIZE); fprintf(fid,'%d\n',255); a = (get(MAINFIG,'userdata'))'; fprintf(fid,'%c',a); fclose(fid); end setting('showtitle') seterror([' Image saved to ',IMAGENAME]); watchoff;end
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -