MATLAB: How to use %s

%savoid tif in the namesaveassavingfilesprintf

Hi all!
I would like to avoid saving the file with the .tif in the name when I use %s during a loop
Here is the code I'm using
baseFileName = tifFiles(j).name;
saveas(gcf,sprintf('%s(%d) .jpeg',baseFileName, j));
Result
input x.tif —> save x.tif(number).jpeg
what i want is
input x.tif —> save x.jpeg
thank you!

Best Answer

saveas(gcf,sprintf('x%d.jpeg',j));
Related Question