I want to save multiple images in a folder?

10 visualizaciones (últimos 30 días)
Shashank Srivastava
Shashank Srivastava el 15 de Mzo. de 2018
Comentada: Sukesh Immadisetty el 31 de Mzo. de 2020
I made the code but the looping variable comes in the string function so a single image is saved in the folder. Is any other way of separating the looping variable from the colon bars.
img=imread('cameraman.tif');
for i=1:5
img=imread('http://satellite.imd.gov.in/img/3Dnesec_ir1.jpg')
imwrite(img,'D:\output database\i.jpg','jpg')% x be a image to write
end

Respuesta aceptada

Jan
Jan el 15 de Mzo. de 2018
Editada: Jan el 26 de Ag. de 2019
for k = 1:5
FileName = sprintf('D:\\output database\\%d.jpg', k)
...
end
  3 comentarios
Stephen23
Stephen23 el 26 de Ag. de 2019
Using fullfile makes the path definition simpler:
for k = 1:5
FileName = fullfile('D:\output database',sprintf('%d.jpg',k))
...
end
Sukesh Immadisetty
Sukesh Immadisetty el 31 de Mzo. de 2020
what to give in place of file name

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by