www.gusucode.com > 声音的处理有:LPC,FFT,共振峰,频谱源码程序 > siganlandsystemusingMatlab/SSUM/library/save_imagedata.m
% function save_imagedata(imagedata, varargin) savedir = pwd; if nargin > 1, filenamepath = varargin{1}; else try cd([ssumroot, 'data/images']); catch cd([ssumroot]); end [filename,path,filterindex] = uiputfile({... '*.tiff.','TIFF'; ... '*.mat','MATLAB database'}, ... 'Save image as'); if isequal(filename,0) | isequal(path,0) return; end filenamepath = [path filename]; end [t,extension] = strtok(filenamepath,'.'); switch(lower(extension)) case {'.tif', '.tiff'} fprintf('Saving %s...\n',filenamepath); imwrite(uint8(imagedata.data),filenamepath,'TIFF'); case '.mat' fprintf('Saving MATLAB database...\n'); imagedata = save(filenamepath,'imagedata'); otherwise warndlg('Image format unsupported!','Bad image file format!'); end cd(savedir);