fig2jpg matlab

figdirectory = './out/';
destpath = './fin/';
fullpath = sprintf('%s/*.fig',figdirectory)
d = dir(fullpath);
length_d = length(d)
if(length_d == 0)
    disp('couldnt read the directory details\n');
    disp('check if your files are in correct directory\n');
end

startfig  = 1
endfig = length_d

for i = startfig:endfig    
    fname = d(i).name;
    disp(['current file --> ' fname]);
    fname_input = sprintf('%s/%s',figdirectory,fname);
    fname_output =  sprintf('%s/%s',destpath,fname(1:end-4));
    hf = openfig(fname_input);
    saveas(hf,fname_output,'jpg');
    close(hf);
end

你可能感兴趣的:(fig2jpg matlab)