Saving data in folders

版本 1.0.0 (1.3 KB) 作者: Sarmed Wahab
This file is for saving the results and figures generated by the matlab in different folders
5.0 次下载
更新时间 2022/9/3

查看许可证

% here the folder path is your directory where you want to save outputs
clear all; clc;
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;
% this i will give new name w.r.t numbering
dest_dir = "D:\folderpath" + 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

引用格式

Sarmed Wahab (2024). Saving data in folders (https://www.mathworks.com/matlabcentral/fileexchange/117105-saving-data-in-folders), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2022a
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.0