How to save the output in a certain folder?
Show older comments
How can I save a certain output in a specified folder? What function can I use for this?
Thank you.
Accepted Answer
More Answers (1)
Sarmed Wahab
on 3 Sep 2022
Moved: Stephen23
on 3 Sep 2022
I am posting this for people finding relative answer.
for i = 1:5
x = rand(10,1) ;
y = 3*x + i^2 ;
plot(x,y,"bo"); hold on;
a = plot(x,y) ; hold off;
dest_dir = "C:\folder\PROJECT DATA\figure" + i ;
mkdir(dest_dir);
filename = "plot"+string(i)+".png";
% saveas(fig,filename)
fig_file = fullfile(dest_dir , filename)
%saveas(a, filename) %save the file there directory
saveas( a, fig_file)
result = "results"+i;
matfile = fullfile(dest_dir, result);
save(matfile);
%save(result)
end
Categories
Find more on File Operations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!