Save figures created on Matlab within a folder
64 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have a series of images generated by a code, for example this one:
A = imread('Example.jpg');
B = imread('Example1.jpg');
C = imread('Example2.jpg');
figure();
image(A);
figure();
image(B);
figure();
image(C);
I want to save these images inside a new folder while keeping the size and name.
I am using mkdir to create a new folder "NewFolder" within a specific folder:
parentdir = 'C:\Users\Alberto\Downloads';
ROOT_FOLDER = 'NewFolder';
newfolder = fullfile(parentdir, sprintf('%s%d', ROOT_FOLDER));
creation_new_folder = mkdir(newfolder);
I do not understand at this point how to save the images created inside this "NewFolder". I thought of something like this but, of course, it doesn't work:
saveas(figure(),'C:\Users\Alberto\Downloads\NewFolder');
2 comentarios
KALYAN ACHARJYA
el 27 de Oct. de 2022
There are a lot of answers in the forum related to the similar question, I have answered the similar question many times too.
Alberto Acri
el 28 de Oct. de 2022
Editada: Alberto Acri
el 28 de Oct. de 2022
Respuestas (1)
Adam Danz
el 28 de Oct. de 2022
- creation_new_folder = mkdir(newfolder); --- "newfolder" is the path to your new folder. "creation_new_folder" is the status of the folder-creation (=1 means successful)
- When saving a specific figure, specify the figure handle as well as the path in the saveas()
fig = figure()
status = mkdir(newfolderPath);
saveas(fig, newfolderPath)
0 comentarios
Ver también
Categorías
Más información sobre Printing and Saving en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!