本文共 510 字,大约阅读时间需要 1 分钟。
更新时间:2021/04/19
function [] = saveimg(img,filename) path = input('Input the path you want to use: ','s'); %以input()作为输入路径的方式,'s'代表以字符串形式写入path path = append(path,filename); %filename中必须包含图片扩展名 imwrite(img,path); %此function中目标文件夹必须已存在,若要创建新文件夹,可以配合mkdir()函数实现end
示例:
imag = imread('myPicture.jpg');for i=1:10 filename = append('Img_',num2str(i),'jpg'); %引入i以实现编号 saveimg(imag,filename);end%output:Input the path you want to use: F:\PictureDownload\%图片被保存到了F:\PictureDownload\Img_1.jpg
转载地址:http://bjugf.baihongyu.com/